package e6_1;
import java.awt.Button;
import java.awt.Color;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Panel;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.awt.Color;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Panel;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
public class FrameWithPanle extends Frame {
public static void main(String[] args) {
FrameWithPanle fwp = new FrameWithPanle("你好!");
fwp.setSize(200, 200);
fwp.setBackground(Color.yellow);
fwp.setLayout(new GridLayout(2, 1));
Panel p = new Panel();
p.setSize(200, 100);
p.setBackground(Color.blue);
p.add(new Button("确定"));
fwp.add(p);
fwp.setVisible(true);
fwp.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
public FrameWithPanle(String str){
super(str);
}
}