'이벤트 헨들러'에 해당되는 글 1건

  1. 2013.02.19 AllEventHandler

AllEventHandler

개발 및 관리/Java 2013. 2. 19. 11:24 posted by HighLighter
반응형

import java.awt.event.*;

class AllEventHandler
          implements ActionListener, ComponentListener, MouseMotionListener,
           MouseListener, MouseWheelListener, KeyListener, TextListener,
           FocusListener, ItemListener,  AdjustmentListener, WindowListener,
           WindowFocusListener, WindowStateListener, ContainerListener
{
 // ActionListener의 메서드
 public void actionPerformed(ActionEvent ae) {}

 // ComponentListener의 메서드
 public void componentMoved(ComponentEvent ae) {}
 public void componentHidden(ComponentEvent ae) {}
 public void componentResized(ComponentEvent ae) {}
 public void componentShown(ComponentEvent ae) {}

 // MouseMotionListener의 메서드
 public void mouseDragged(MouseEvent me) {}
 public void mouseMoved(MouseEvent me) {}

 // MouseListener의 메서드
 public void mousePressed(MouseEvent me) {}
 public void mouseReleased(MouseEvent me) {}
 public void mouseEntered(MouseEvent me) {}
 public void mouseExited(MouseEvent me) {}
 public void mouseClicked(MouseEvent me) {}

 // MouseWheelListener의 메서드
 public void mouseWheelMoved(MouseWheelEvent e) {}
 
 // KeyListener의 메서드
 public void keyPressed(KeyEvent ke) {}
 public void keyReleased(KeyEvent ke) {}
 public void keyTyped(KeyEvent ke) {}
 
 // TextListener의 메서드
 public void textValueChanged(TextEvent te) {}
 
 // FocusListener의 메서드
 public void focusGained(FocusEvent fe) {}
 public void focusLost(FocusEvent fe) {}
 
 // ItemListener의 메서드
 public void itemStateChanged(ItemEvent ie) {}
 
 // AdjustmentListener의 메서드
 public void adjustmentValueChanged(AdjustmentEvent ae) {}
 
 // WindowListener의 메서드
 public void windowClosing(WindowEvent we) {}
 public void windowOpened(WindowEvent we) {}
 public void windowIconified(WindowEvent we) {}
 public void windowDeiconified(WindowEvent we) {}
 public void windowClosed(WindowEvent we) {}
 public void windowActivated(WindowEvent we) {}
 public void windowDeactivated(WindowEvent we) {}
 
 // WindowFocusListener의 메서드
 public void windowGainedFocus(WindowEvent e) {}
 public void windowLostFocus(WindowEvent e) {}
 
 // WindowStateListener의 메서드
 public void windowStateChanged(WindowEvent e) {}
 
 // ContainerListener의 메서드
 public void componentAdded(ContainerEvent ce) {}
 public void componentRemoved(ContainerEvent ce) {}
} // End of EventHandler class

 

 

EventTest.java
다운로드

 

1. 키보드의 키 하나를 계속 누르고 있을 때 어떤 일이 생기는지 확인하라

2. Ctrl과 Alt 같은 특수키를 눌렀을 때와 일반키를 눌렀을 때를 비교하라.

3. TextField에서 Enter키를 눌렀을 때

4. Tab키를 눌러서 focus를 이동했을 때

5. 마우스의 포인터를 Frame에서 Canvas의 영역 안으로 이동했을 때(그리고, 그 반대로)

6. List에 있는 item 하나를 선택해서 더블클릭했을 때

7. Choice에서 다른 item을 선택했을 때

8. Frame의 크기를 변경했을 때

 

AllEventHandler.java
다운로드

 

From 자바의 정석 p.756

 

반응형