我正在学习一个教程并制作了一个 JFrame,但它非常小。我在这个网站上搜索了这个问题,但没有任何帮助。有人知道问题吗?我完全按照教程做的,它对他有用!我也会发一张它的照片。
这是代码:
package net.trails.std;
import java.applet.Applet;
import java.awt.Dimension;
import java.awt.Image;
import javax.swing.JFrame;
public class Core extends Applet implements Runnable {
private static final long serialVersionUID = 1L;
private static JFrame frame;
public static double dY = 0, dX = 0;
public static final int res = 1;
public static int dir = 0;
public static boolean moving = false;
public static boolean run = false;
private Image screen;
public static Dimension screenSize = new Dimension(700, 560);
public static Dimension pixel = new Dimension(screenSize.width, screenSize.height);
public static Dimension size;
public static String name = "Trails";
public Core(){
}
public static void main(String[] args) {
Core core = new Core();
frame = new JFrame();
frame.add(core);
size = new Dimension(frame.getWidth(), frame.getHeight());
frame.setSize(700, 560);
frame.setTitle(name);
frame.setResizable(false);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
core.start();
}
public void run() {
}
}