TestButtonMain ¶
~cpp import java.applet.*; import java.awt.Button; import java.awt.event.*; public class TestButtonMain extends Applet implements ActionListener{ private Button b1= new Button("click here!"); public TestButtonMain(){ this.add(b1); b1.addActionListener(this); } public void actionPerformed(ActionEvent e) { TestFrame t= new TestFrame(); t.setSize(200, 200); t.setName("애플릿 내에서 창 만들기"); t.show(); } }
TestFrame ¶
~cpp import java.awt.Color; import java.awt.Frame; import java.awt.event.*; public class TestFrame extends Frame implements WindowListener{ public TestFrame(){ this.addWindowListener(this); this.setBackground(Color.blue); } public void windowClosing(WindowEvent e) { this.dispose(); } public void windowActivated(WindowEvent e) {} public void windowClosed(WindowEvent e) {} public void windowDeactivated(WindowEvent e) {} public void windowDeiconified(WindowEvent e) {} public void windowIconified(WindowEvent e) {} public void windowOpened(WindowEvent e) {} }