您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

previous.gif
 (3087 bytes) next.gif
 (2959 bytes)


Content Index Content Page # 21

AWT Frame windows

When working with applets, the applet viewer or Web browser automatically creates a screen window for your program's output to appear in. However, if you are writing a stand-alone application (described in the next unit) your program must create its own main window. Typically an object of class Frame does this. The figure below shows the appearance of an empty Frame object on a Windows system.

This can be created by:

Frame myFrame = new Frame("Run");

myFrame.show();

The show() method makes the frame visible on the screen.

Of course, an empty Frame is not particularly useful. The next unit describes the role of the Frame class in providing stand-alone Java applications.

Back to top

basicline.gif (170 bytes)