frame.setPreferredSize(新尺寸(350, 200)); |
import java.awt.Dimension;References:
导入 javax.swing.JFrame;
public class Test extends JFrame{
public static void main(String[] args) {
//创建 JFrame
JFrame jframe = new JFrame(JFrame resizing”);
jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//修改 JFrame
jframe.setPreferredSize(new Dimension(300, 200));
//中心 JFrame
jframe.setLocationRelativeTo(null);
jframe.setVisible(true);
}
}
Please disable your ad blocker and refresh the window to use this website.