Introduction To Swing
Introduction To Swing
Swing
Provides a native look and feel that emulates the look and feel
of several platforms, and also supports a pluggable look and
feel
Controller takes the input from the user on the view and reflects the
changes in Component's data.
Behavior: These are events which occur when the user interacts
with UI elements. This part will be covered in Event Handling
chapter.
Important Classes
Component Class : The class Component is the abstract base class for the non menu
user-interface controls of AWT. Component represents an object with graphical
representation.
Container Class: The class Container is the super class for the containers of AWT.
Container object can contain other AWT components.
JComponent Class: The class JComponent is the base class for all Swing components
except top-level containers. To use a component that inherits from JComponent, you must
place the component in a containment hierarchy whose root is a top-level Swing container.
JLabel Class: The class JLabel can display either text, an image, or both. Label's contents
are aligned by setting the vertical and horizontal alignment in its display area. By default,
labels are vertically centered in their display area. Text-only labels are leading edge
aligned, by default; image-only labels are horizontally centered, by default.
JButton Class: The class JButton is an implementation of a push button. This component
has a label and generates an event when pressed. It can have Image also.
Etc………………
Important Interfaces
SWING Event Listeners The Event listener represent the interfaces
responsible to handle events. Java provides us various Event listener classes but
we will discuss those which are more frequently used. Every method of an event
listener method has a single argument as an object which is subclass of
EventObject class. For example, mouse event listener methods will accept
instance of MouseEvent, where MouseEvent derives from EventObject.
Etc……
Look into code samples…..
Sources (Most important part)
http://www.tutorialspoint.com/swing/swing_quick_guide.htm
http://www.tutorialspoint.com/swing/
http://en.wikipedia.org/wiki/Swing_(Java)
http://docs.oracle.com/javase/tutorial/uiswing/