所以我一直在制作一个Java应用程序(HypoPixel),我希望它能成为一个游戏。 无论如何,所以我最近对其进行了修改,但我不知道是什么原因导致无法打开。 你能帮我吗?
import java.awt.*;
import javax.swing.*;
class FPS {
static double FPS = 0;
public static void handle() {
FPS = 60;
}
public static void crunch() {
FPS = FPS / 2.38482984839483829384928392;
}
}
class Clock {
static int ticks = 0;
public static int tick(int args) {
ticks += args;
return ticks;
}
}
public class Frame {
public static int Loop = 1;
public void main(String[] args) {
while(Loop == 1) {
try {
double VersionNumber = 0.01;
Dimension size = new Dimension(800,600);
String widget1 = "resourcepacks\\defualt\\assets\\textures\\widgets\\button.png";
String titleBG = "resourcepacks\\defualt\\assets\\textures\\title\\sky.png";
String Sun = "resourcepacks\\defualt\\assets\\textures\\misc\\sun1.png";
JFrame Window = new JFrame();
Clock time = new Clock();
FPS Frames = new FPS();
int TOD;
int IT = time.tick(1);
Window.setPreferredSize(size);
Window.setMinimumSize(size);
Window.setResizable(false);
Window.setContentPane(new JLabel(new ImageIcon(titleBG)));
Window.pack();
Window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Window.setTitle("Game");
Window.setLocationRelativeTo(null);
Window.setVisible(true);
while(IT >= 0) {
System.out.println(IT);
IT = time.tick(1);
while(IT > 0) {
TOD = IT / 2400000;
}
}
} catch(Exception e) {
Dimension size = new Dimension(800,600);
JFrame Window = new JFrame();
Window.setTitle("Game");
Window.setPreferredSize(size);
Window.setResizable(false);
Window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Window.setLocationRelativeTo(null);
Window.setContentPane(new JLabel("Sorry, an error occurred"));
e.printStackTrace();
Window.pack();
Window.setVisible(true);
}
}
}
}