标签:list override null string window tla ada stat ane
package cn.rushangw.lesson01;
import sun.awt.WindowClosingListener;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
public class TestPanel {
public static void main(String[] args) {
Frame frame = new Frame();
Panel panel = new Panel();
//设置布局
frame.setLayout(null); //如果这个不设置 他就会默认布局
//坐标
frame.setBounds(300,300,500,500);
frame.setBackground(new Color(1,1,1));
//panel设置坐标,相对于frame
panel.setBounds(50,50,400,400);
panel.setBackground(new Color(201, 23, 23));
//frame.add(panel)
frame.add(panel);
frame.setVisible(true);
//监听事件,监听窗口关闭事件
frame.addWindowListener(new WindowAdapter() {
//窗口点击关闭的时候
@Override
public void windowClosing(WindowEvent e) {
//结束程序
System.exit(0);//0 正常退出 1 异常退出
}
});
}
}
标签:list override null string window tla ada stat ane
原文地址:https://www.cnblogs.com/nigustudent/p/14774209.html