Some Further AWT Components: Window (Frame and Dialog)
Up to now, we have described how to build typical Applet panels inside browser window. There are classes that allow one to generate complete windows separately from the browser window
Window Class has subclasses Frame and Dialog
Create a window with a given title:
- Frame f = new Frame("TitleofWindow");
- Frames appear and disappear by using the method setVisible:
- f.setVisible(true); // makes the window appear on the screen
- f.setVisible(false); // makes the window disappear from the screen
- Note Frame is a Container and can thereof be defined hierarchically with components that are laid out by LayoutManagers
- Note a Frame in Java is NOT THE SAME as a frame in HTML