go to previous page   go to home page   go to next page

Answer:

Yes. The user can manipulate the window (the frame) as usual.


Running the Program

The program is an application, so it has a main() method where it starts running. Even though it does not do much, run this program and play with it. To run the program, first copy-paste-save the program to a file called TestFrame1.java. Then, compile it and run it as usual:

C:\JavaCode\> javac TestFrame1.java
C:\JavaCode\> java  TestFrame1
         
     program runs and displays the frame

The program displays an empty frame. While the program is running, you can click on the frame and drag it around, you can minimize it, you can grab a border and resize it, and so on. All of this is built into the JFrame class. Your program gets all of these features when it constructs a JFrame object.

The frame remains "alive", even though there is nothing explicit in the program to keep it running. To stop the program, click on the "close button".


QUESTION 4:

What do you suppose this line from the program does?

JFrame frame = new JFrame("Test Frame 1");