发布网友 发布时间:2022-05-03 02:10
共1个回答
热心网友 时间:2023-10-05 06:13
JFrame frame = new JFrame();追答public static void main(String[] args) {
ShowBoxLayout applet = new ShowBoxLayout();
JFrame frame = new JFrame();
//EXIT_ON_CLOSE == 3
frame.setDefaultCloseOperation(3);
frame.setTitle("ShowBoxLayout");
frame.getContentPane().add(applet, BorderLayout.CENTER);
applet.init();
applet.start();
frame.setSize(400,320);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((d.width - frame.getSize().width) / 2,
(d.height - frame.getSize().height) / 2);
frame.setVisible(true);
}