If you change frame.setSize( 150, 100 )
to
frame.setSize( 300, 100 )
how will the frame appear?
The frame will be 300 pixels wide by 100 high, twice as wide as previous.
A JFrame object has a setSize()
method that is used to change
the size of the frame on the computer monitor.
The size can be changed as the program runs.
For example, the following program works
(although it is mostly useless):
import java.awt.*; import javax.swing.*; public class TestFrame1 { public static void main ( String[] args ) { int height=100, width=200; JFrame frame = new JFrame("Test Frame 1"); frame.setSize( width, height ); frame.setVisible( true ); frame.setSize( width+50, height+75 ); } }