java OO graphical interface summary (supplement)

JDK1.8 local inner classes and anonymous inner classes, use the default layout variables are all final modification of the constants

Before JDK1.8, you must manually declare final String key ..... This variable can be used in local inner classes and anonymous inner classes

Or will direct error

ActionListener is a common event, each control has such an event

However, some special control methods have their own independent event

ombo use ActionListener drawback is that if the currently selected entry is selected again, or will trigger events

If the drop-down menu item changing itemStateChanged

In fact, this method will trigger twice, once original entry is not selected, a new entry is chosen

Therefore, generally require determination, only operates when a selected

Scrollbar: JScrollPane Pane = new new JScrollPane (content);

Set the default visible height ... is the number of visible lines, note the scroll bar to the joint use with  jlist.setVisibleRowCount (3);

Set the width jlist.setFixedCellWidth (150);

Setting the height of each row  jlist.setFixedCellHeight (50);

Set the radio or multi-select  jlist.setSelectionMode (ListSelectionModel.SINGLE_SELECTION);

Container buffering delay is reduced

JOptionPane (box) .showMessageDialog (dialog box)

.addSeparator (); interval

(Char) 8; backspace

repaint (); window refresh

public void keyReleased (KeyEvent e) { } When the keyboard release trigger

public void keyPressed (KeyEvent e) { } When triggered when the keyboard is pressed

All the keys on the keyboard, have specific coding static constant target KeyEvent.VK_ENTER

public void mouseReleased (MouseEvent e) { } mouse release triggered when the

public void mouseEntered (MouseEvent e) { } mouse enters triggered when the

public void mouseClicked (MouseEvent e) { } mouse click when the trigger

public void mouseMoved (MouseEvent e) { }   mouse movement when the trigger

public void mouseDragged (MouseEvent e) { } mouse drag triggered when the

(MouseWheelEvent e) {} public void mouseWheelMoved middle mouse wheel scroll triggered when the

MouseAdapter is actually a realization of the abstract class for all mouse interface, the role is to make the following implementation class not so much to achieve a lot of unnecessary method

Guess you like

Origin www.cnblogs.com/ArrayStoreException/p/12055886.html