package title;
import java.awt.*;
import java.awt.event.*;
public class AWTFrame extends WindowAdapter{
Frame myFrame;
Label myLabel;
public AWTFrame()
{
myFrame = new Frame("Frame");
myLabel = new Label("Label");
myFrame.add(myLabel);
myFrame.setSize(200,200);
myFrame.setLayout(new FlowLayout());
myFrame.setVisible(true);
myFrame.addWindowListener(this);
}
public void windowClosing(WindowEvent e)
{
myFrame.dispose();
}
public static void main(String args[])
{
new AWTFrame();
}
}
时间: 2024-10-20 11:26:48