반응형
ActionEvent :: 키보드 입력, 마우스 이동,
버튼 이벤트 -> 액션 이벤트로 받음.
마우스 이벤트는 별도.
Ex) Button.addActionListener( ); :: 버튼의 액션 이벤트 감지.
각각의 버튼 마다 Listener 를 달아야 함.
자동실행 메소드(이벤트 핸들러)
public void ActionPerformed (ActionEvent ae)
{
ActionEvent에 따른 작업할 내용들.
}
CaretHandler
JscrollBar
GetActionCommand() :: 버튼을 눌렀다면, 버튼의 이름을 가져오는 함수.
버튼 이벤트 -> 액션 이벤트로 받음.
마우스 이벤트는 별도.
Ex) Button.addActionListener( ); :: 버튼의 액션 이벤트 감지.
각각의 버튼 마다 Listener 를 달아야 함.
자동실행 메소드(이벤트 핸들러)
public void ActionPerformed (ActionEvent ae)
{
ActionEvent에 따른 작업할 내용들.
}
Button.addActionListener(this); :: 내 클래스 내부에서의 실행메소드 를 찾음. |
Button.addActionListener(new Ehandler); :: Ehandler 클래스 내의 실행메소드에서 찾음 == ActionListener Listener = new Ehandler; Button.addActionListener(Listener); class Ehandler implements ActionListener { 자동실행 메소드 } 자동실행 메소드(이벤트 핸들러) public void ActionPerformed (ActionEvent ae) { ActionEvent에 따른 작업할 내용들. } |
CaretHandler
JscrollBar
GetActionCommand() :: 버튼을 눌렀다면, 버튼의 이름을 가져오는 함수.