GUI核心技术Swing AWT
-
JRE 环境
-
丑 画面不美观
作用
-
了解监听
-
学习MVC
AWT
2.1AWT介绍
-
包含很多类和接口
-
元素: 窗口 按钮 文本框
-
组件 component: button textArea label container
-
2.2组件 和容器
frame
-
frame 构造函数
-
窗口大小
-
窗口可见性
-
背景颜色
-
color 颜色
-
弹出的初始位置 setlocation 00 左上角
-
设置额大小固定 setResize 不能改变大小
窗口关闭不掉
思路 :继承Frame 所以实现封装方法
package com.GUI; import java.awt.*; public class FraDemo01 { public static void main(String[] args) { Frame frame = new Frame(); // 设置大小 frame.setSize(300,300); //设置颜色 frame.setBackground(Color.darkGray); //设置位置 frame.setLocation(300,300); //设置可见性 frame.setVisible(true); //设置可不可以 伸缩 frame.setResizable(false); } }
package com.GUI; import java.awt.*; public class FraDemo02 extends Frame { static int count =0; FraDemo02 (int x, int y, int len, int wid,Color color) { super("我的窗口"+(++count)); setBackground(color); setBo