Week 13

Other common methods JCheckBox following categories:
getState (): Get the state of the selection box.
setState (boolean b): setting a state selection box
getLabel (): Get the title selection box.
setLabel (String s): Set selection box title.
isSelected (): Gets whether the checkbox is checked state.
itemStateChanged (ItemEvent e): event processing selection box interface methods.
getItemSelectable (): Gets an option to acquire the event source.
addItemListener (ItemListener l): is set to monitor the selection box.
removeItemListener (ItemListener l): Remove a monitor selection box.

The main study and various event listener process
1) keyboard surveillance
using KeyListener Interface
2) mouse listener
using MouseListener interfaces, wherein there MouseEvent getButton (), getX (), getY () method, etc.
3) radio button: JRadioButton event and processing
method:
setSelected (); if selected
setText (String); set the display text
setIcon (Icon); set the picture
its event processing using ItenListener
4) box: JCheckBoxji event handler
method:
JCheckBox (); create text objects
whose events process is also used ItemListener Interface
5) list box: JList and event handling
method:
int [] getSeletrdIndices (); return all the selected array
Jlist (ListModel / Object [] listData / Vector listData); configured JList <?>
which event processing use ListSelectionListener Interface
menu component
JMenu, JMenuBar, JMenuItem simple menu appearance can be achieved using event listener can correspond to implement some functions, such as code Notepad

More error codes, is still in perfect stage, absent one week because there are a lot of things are looking, so the need to forge ahead.

Guess you like

Origin www.cnblogs.com/gaotian250yj912/p/11919184.html