@# AUI的概念
比较古老,但是需要理解一下。监听和MVC架构,
其中核心技术就是Swing 和AWT
1、AWT
1.1 AWT介绍
1.包含了很多类和接口; GUI:图形页面
2.元素;窗口,按钮,文板框
3.java.awt
2.组件和容器
package com.guoguo.lesson01;
import java.awt.*;
public class testFrame {
public static void main(String[] args) {
//Frame.jdk 看源码
Frame frame = new Frame("图形界面窗口");
//看不见,设置可见性
frame.setVisible(true);
//设置大小
frame.setSize(400,500);
//设置背景颜色
//Color color = new Color();
frame.setBackground(new Color(70, 72, 104));
//弹出的初始位置
frame.setLocation(200,200);
//设置大小固定
frame.setResizable(false);
}
}
不能关闭
多窗口
package com.guoguo.lesson01;
import java.awt.*;
public class lesson02frame {
public static void main(String[] args) {
//展示多个窗口
new MyFrame(100,100,200,200,Color.blue);
new MyFrame(300,100,200,200,Color.yellow);
new MyFrame(100,300,200,200,Color.red);
new MyFrame(300,300,200,200,Color.green);
}
}
//继承Frame类
class MyFrame extends Frame{
static int id =0;//可能存在多个窗口,我们需要一个计数器
public MyFrame(int x,int y,int w,int h,Color color){
super("Myframe"+(++id));
setBackground(color);
setBounds(x,y,w,h);
setVisible(true);
}
}