U E D R , A S I H C RSS

JTD Study/두번째과제/장길

No older revisions available

No older revisions available



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) {}
}

후기

* 너무 오랫만에 숙제를 했네요....... windfencer.zerpage.org 여기에 들어가면 위 소스로 만든 애플릿을 확인하실수 있습니다. - 장길 -
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:29
Processing time 0.0507 sec