A Choice is displayed in a compact form that requires you to pull it down to see the list of available choices. Only one item may be selected from a Choice. A List may be displayed in such a way that several List items are visible. A List supports the selection of one or more List items.
All AWT event listeners extend the java.util.EventListener interface.
A layout manager is an object that is used to organize components in a container.
A Scrollbar is a Component, but not a Container. A ScrollPane is a Container. A ScrollPane handles its own events and performs its own scrolling.
The only thread-safe methods are repaint(), revalidate(), and invalidate()
The Window, Frame and Dialog classes use a border layout as their default layout
The preferred size of a component is the minimum component size that will allow the component to display normally
The Panel and Applet classes use the FlowLayout as their default layout
The Canvas, Frame, Panel, and Applet classes support painting
Clipping is the process of confining paint operations to a limited area or shape.
The CheckboxMenuItem class extends the MenuItem class to support a menu item that may be checked or unchecked.
The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy
Most of the AWT-related events of the event-delegation model are defined in the java.awt.event package. The AWTEvent class is defined in the java.awt package.
A Canvas object provides access to a Graphics object via its paint() method.
The elements of a BorderLayout are organized at the borders (North, South, East, and West) and the center of a container.
The Frame class extends Window to define a main application window that can have a menu bar.
The FontMetrics class is used to define implementation-specific properties, such as ascent and descent, of a Font object.
The elements of a CardLayout are stacked, one on top of the other, like a deck of cards.
When a window is repainted by the AWT painting thread, it sets the clipping regions to the area of the window that requires repainting.
An event-listener interface defines the methods that must be implemented by an event handler for a particular kind of event. An event adapter provides a default implementation of an event-listener interface.
A component can handle its own events by implementing the required event-listener interface and adding itself as its own event listener.
The elements of a GridBagLayout are organized according to a grid. However, the elements are of different sizes and may occupy more than one row or column of the grid. In addition, the rows and columns may have different sizes.
Java uses layout managers to lay out components in a consistent manner across all windowing platforms. Since Java's layout managers aren't tied to absolute sizing and positioning, they are able to accomodate platform-specific differences among windowing systems.
The paint() method supports painting via a Graphics object. The repaint() method is used to cause paint() to be invoked by the AWT painting thread.
By associating Checkbox objects with a CheckboxGroup
The key point is that the paint() method invokes three methods in the following order:
- paintComponent()
- paintBorder()
- paintChildren()
As a general rule, in Swing, you should be overriding the paintComponent method unless you know what you are doing. paintComponent() paints only component (panel) but paint() paints component and all its children.
paint : is only called when the applet is displayed for the first time, or when part of the applet window has to be redisplayed after it was hidden.
repaint : is used to display the next image in a continuous loop by calling the update method.
update : you should be aware that, if you do not implement it yourself, there is a standard update method that does the following : it will reset the applet window to the current background color (i.e. it will erase the current image) it will call paint to construct the new image
MVC(Model View Controller) pattern
- Flow Layout Manager
- Grid Layout Manager
- Border Layout Manager
- Box Layout Manager
- Card Layout Manager
- GridBag Layout Manager