|
// STYLE 1
JFrame aWindow = new JFrame(“This is the Window Title”);
int windowWidth = 400; // Window width in pixels
int windowHeight = 150; // Window height in pixels
aWindow.setBounds(50, 100, // Set position
windowWidth, windowHeight); // and size
aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
aWindow.setVisible(true);
// STYLE 2
JFrame aWindow = new JFrame(“This is the Window Title”);
aWindow.setBounds(50, 100, // Set position
400, 150); // and size
//windowWidth, windowHeight); // and size
aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
aWindow.setVisible(true);
如果不要人家看明白就style 2
style 1 会用多几行 |
|