Professional Documents
Culture Documents
1 ActionListener actionPerformed
2 AdjustmentListener adjustmentValueChanged
3 ItemListener itemStateChanged
4 TextListener textValueChanged
componentMoved
componentHidden
5 ComponentListener
componentResized
componentShown
componentAdded
6 ContainerListener componentRemoved
focusGained
7 FocusListener
focusLost
keyPressed
keyReleased
keyTyped
8 KeyListener
mousePressed
mouseReleased
mouseEntered
9 MouseListener mouseExited
9 MouseListener
mouseClicked
mouseDragged
10 MouseMotionListener
mouseMoved
windowClosing
windowOpened
windowIconified
11 WindowListener windowDeiconified
windowClosed
windowActivated
windowDeactivated
dling Summary
Parameter/Accessors Events Generated By
ActionEvent Button
getActionCommand JComboBox
getModifiers JTextField
Timer
AdjustmentEvent JScrollbar
getAdjustable
getAdjustmentType
getValue
ItemEvent getItem AbstractButton
getItemSelectable JComboBox
getStateChange
TextEvent
ComponentEvent Component
getComponent
containerEvent Container
getChild
getContainer
FocusEvent Component
isTemporary
KeyEvent Component
getKeyChar
getKeyCode
getKeyModifiersText
getKeyText
isActionKey
MouseEvent Component
getClickCount
getX
getY
getPoint
translatePoint
isPopupTrigger
MouseEvent Component
WindowEvent Window
getWindow
Event Source & Listener
Interface Events Source
Button
JComboBox
ActionListener
JTextField
Timer
JScrollbar
AdjustmentListener
AbstractButton
ItemListener JComboBox
Component
ComponentListener
Container
ContainerListener
Component
FocusListener
Component
KeyListener
Component
MouseListener
MouseListener
Component
MouseMotionListener
Window
WindowListener
Sr. No. Class Description
AWTEvent Encapsulates AWT events.
1
Button
Check Boxes
CheckboxGroup
Choice
Lists
Scroll Bars
TextField
TextArea
Label( )
Label(String str)
Button(String caption)
Checkbox( )
Checkbox(String str)
Checkbox(String str, boolean on)
Checkbox(String str, boolean on, CheckboxGroup cbGroup)
Checkbox(String str, CheckboxGroup cbGroup, boolean on)
Choice( )
List( )
List(int numRows)
List(int numRows, boolean multipleSelect)
Scrollbar( )
Scrollbar(int style)
Scrollbar(int style, int initialValue, int thumbSize, int min, int max)
TextField( )
TextField(int numChars)
TextField(String str)
TextField(String str, int numChars)
TextArea( )
TextArea(int numLines, int numChars)
TextArea(String str)
TextArea(String str, int numLines, int numChars)
TextArea(String str, int numLines, int numChars, int sBars)
The first version creates a blank label.
String getText( )
void setAlignment(int how)
int getAlignment( )
boolean getState( )
void setState(boolean on)
String getLabel( )
void setLabel(String str)
Checkbox getSelectedCheckbox( )
void setSelectedCheckbox(Checkbox which)
String getText( )
void setText(String str)
String getSelectedText( )
void select(int startIndex, int endIndex)
boolean isEditable( )
void setEditable(boolean canEdit)
void setEchoChar(char ch)
boolean echoCharIsSet( )
char getEchoChar( )
Button
Check Boxes
CheckboxGroup
Choice
Lists
Scroll Bars
TextField
TextArea
Label( )
Label(String str)
Button(String caption)
Checkbox( )
Checkbox(String str)
Checkbox(String str, boolean on)
Checkbox(String str, boolean on, CheckboxGroup cbGroup)
Checkbox(String str, CheckboxGroup cbGroup, boolean on)
Choice( )
List( )
List(int numRows)
List(int numRows, boolean multipleSelect)
Scrollbar( )
Scrollbar(int style)
Scrollbar(int style, int initialValue, int thumbSize, int min, int max)
TextField( )
TextField(int numChars)
TextField(String str)
TextField(String str, int numChars)
TextArea( )
TextArea(int numLines, int numChars)
TextArea(String str)
TextArea(String str, int numLines, int numChars)
TextArea(String str, int numLines, int numChars, int sBars)
The first version creates a blank label.
String getText( )
void setAlignment(int how)
int getAlignment( )
boolean getState( )
void setState(boolean on)
String getLabel( )
void setLabel(String str)
Checkbox getSelectedCheckbox( )
void setSelectedCheckbox(Checkbox which)
String getText( )
void setText(String str)
String getSelectedText( )
void select(int startIndex, int endIndex)
boolean isEditable( )
void setEditable(boolean canEdit)
void setEchoChar(char ch)
boolean echoCharIsSet( )
char getEchoChar( )
FlowLayout
BorderLayout
GridLayout
Methods
setLayout( )
Constructors
FlowLayout( )
FlowLayout(int how)
FlowLayout(int how, int horz, int vert)
BorderLayout( )
BorderLayout(int horz, int vert)
GridLayout( )
GridLayout(int numRows, int numColumns)
GridLayout(int numRows, int numColumns, int horz, int vert)
Layout Managers
Syntax
void setLayout(LayoutManager layoutObj)
Parameter
Valid values for how are as follows:
FlowLayout.LEFT
FlowLayout.CENTER
FlowLayout.RIGHT
FlowLayout.LEADING
FlowLayout.TRAILING
BorderLayout.SOUTH
BorderLayout.WEST
BorderLayout.NORTH
BorderLayout.EAST
BorderLayout.CENTER
out Managers
SetLayout(LayoutManagerObj);
setLayout(new FlowLayout(FlowLayout.LEFT));
setLayout(new BorderLayout());
Swing
JLabel
JButton JCheckBox
JRadioButton ButtonGroup
JComboBox
JList
JScrollBar
JTextField JTextArea JPasswordField
JMenuBar
JMenu
JMenuItem JCheckBoxMenuItem JRadioButtonMenuItem
JPopupMenu
Sr. No. Listener Interface Adapter Class
1 ComponentListener ComponentAdapter
2 ContainerListener ContainerAdapter
3 FocusListener FocusAdapter
4 KeyListener KeyAdapter
5 MouseListener MouseAdapter
6 MouseMotionListener MouseMotionAdapter
7 WindowListener WindowAdapter
Methods of AdapterClass
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent me) {
showStatus("Mouse Pressed");
}
});