Java Reference
In-Depth Information
List Selection
Listener
(ListSelectionListener) -
addListSelectionListener
Fires
ListSelectionEvent
when selection changes in the
component's items.
Only
JList
and
JTable
accept
this listener.
valueChanged
: Code that reacts
when another item is selected
from the component's items.
Window Listener
(WindowListener) -
addWindowListener
Fires
WindowEvent
when state
changes occur in windowed
components.
JDialog
and
JFrame
accept this
listener.
windowOpened
: Code that reacts
when window has been shown for
first time (in program's execution).
windowClosing
: Code that reacts
when user requests the window
to close.
windowClosed
: Code that reacts
just after window has closed.
windowIconified
and
windowDeiconified
: Code that
reacts when window is minimized
or unminimized.
windowActivated
and
window-
Deactivated
: Code that reacts
when window is activated or
deactivated. This method will
not work with frames or dialogs,
so you need to use the Window
FocusListener
here instead.
Window Focus Listener
(WindowFocusListener) -
addWindowFocusListener
Fires
WindowEvent
when a
windowed component gains or
loses focus.
JDialog
and
JFrame
accept this
listener.
windowGainedFocus
and
win-
dowLostFocus
: Code that reacts
when window gains or loses focus.
Window State Listener
(WindowStateListener) -
addWindowStateListener
Fires
WindowEvent
when the
state of a windowed component
changes, such as is maximized or
minimized.
JDialog
and
JFrame
accept this
listener.
windowStateChanged
: Code
that reacts when window is being
(un)minimized, maximized, or
returned to normal.
Component Listener
(ComponentListener) -
addComponentListener
Fires
ComponentEvent
when a
component is hidden, moved,
resized, or shown.
All components accept this
listener.
componentHidden
and
componentShown
: Code that
reacts when component is made
invisible or visible.
componentMoved
and
componen-
dResized
: Code that reacts when
position or dimensions of compo-
nent changes.
continues
Search WWH ::
Custom Search