Java Reference
In-Depth Information
This frame will be 300 pixels wide and 400 pixels tall. If you omit this step the
frame will be 0 by 0 pixels, and you won't be able to see it.
3. If you'd like, set the title of the frame.
frame.setTitle("An Empty Frame");
If you omit this step, the title bar is simply left blank.
4. Set the Ȓdefault close operationȓ:
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Figure 21
A Frame Window
58
59
When the user closes the frame, the program automatically exits. Don't omit this
step. If you do, the program continues running even after the frame is closed.
5. Make the frame visible.
frame.setVisible(true);
Search WWH ::




Custom Search