import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextArea;
public class EventTest2 extends JFrame
{
JTextArea ta;
JButton button;
public EventTest2()
{
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(400, 300);
this.setVisible(true);
ta = new JTextArea();
button = new JButton("클릭");
button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
ta.append("내부 무명 클래스"+'\n');
}
});
add(ta);
add("North", button);
}
public static void main(String[] args)
{
new EventTest2();
}
}
댓글 없음:
댓글 쓰기