Java Reference
In-Depth Information
Component
(abstract class)
Container
(abstract class)
Panel
(old concrete container)
Window
(no borders or title bar)
JComponent
(base for Swing components)
Applet
(old applet class)
Frame
(old frame class)
Classes defining specific
Swing components
Dialog
(old dialog class)
JDialog
(old dialog class)
JWindow
(no borders or title bar)
JApplet
JFrame
Base class
for applets
Base class for
application windows
Base class for dialogs
This shows some of the subclasses of Component - the ones that are important to us at the moment.
We discussed the chain through to JFrame earlier, but the other branches are new. The classes that we
will be using directly are all the most commonly derived classes.
Let's summarize how you would typically use the key classes in this hierarchy:
Class
Use
JFrame
This is used as the basic Java application window. An object of this class has a
title bar and provision for adding a menu. You can also add other components
to it. You will usually subclass this class to create a window class specific to
your application. It is then possible to add GUI components or draw in this
window if required, as we will see.
JDialog
You use this class to define a dialog window that is used for entering data into
a program in various ways. You usually code the creation of a dialog in
response to some menu item being selected.
JApplet
This is the base class for a Java 2 applet - a program designed to run
embedded in a web page. All your Java 2 applets will have this class as a base.
You can draw in a JApplet and also add menus and other components.
JComponent
The subclasses of JComponent define a range of standard components such as
menus, buttons, checkboxes, and so on. You will use these classes to create
the GUI for your application or applet.
Search WWH ::




Custom Search