Listener example

  • ActionListener
button.addActionListener (new new ActionListener () { 
            public void actionPerformed (ActionEvent arg0) {//  Click event of the button 
                do_button_actionPerformed (arg0); 
            } 
        });
  • KeyListener
arrayField.addKeyListener (the KeyListener new new () { 
			public void the keyPressed (KeyEvent E) {// key is pressed 
				
			} 

			@Override 
			public void the keyReleased (KeyEvent E) {// key is up 
				method of automatically generating stubs TODO // 
				
			} 

			@Override 
			public void keyTyped (KeyEvent e) {// key is pressed, and the pop-up (when the character is input trigger) 
				do_arrayField_keyPressed (E);   
				
			} 
		});
  • ItemListener
proBox.addItemListener ({new ItemListener () 
			triggers public void itemStateChanged (final ItemEvent e) {// contents change 
				itemChange (); 
			} 
		});

 

Guess you like

Origin www.cnblogs.com/comicfuji/p/10991774.html