当前位置:网站首页>GUI_AWT
GUI_AWT
2022-08-10 05:32:00 【cbys-1357】
活动地址:CSDN21天学习挑战赛
三大容器:window,panl,Scrollpane;
注意:window用frame类实现
布局管理器
常见布局管理器:FlowLayout ,BorderLayout,GridLayout,GridBagLayout,CardLayout,BoxLayout等。
window 默认BorderLayout布局管理器
Panel默认FlowLayout布局管理器
Scrollpane默认BorderLayout布局管理器
FlowLayout 从左向右排列所有的组件,遇到边界会折回下一行重新开始
构造方法
FlowLayout()
FlowLayout(int align)
FlowLayout(int align,int hgap,int vgap)
BorderLayout 将容器分为EAST,SOUTH,WEST,NORTH,CENTER五个区域
构造方法
BorderLayout();
BorderLayout(int hgap,int vgap);
GirdLayout 网格布局管理器分割分隔的网格
构造方法
GridLayout(int rows,int cols)
GirdLayout(int rows,int cols,int hgap,int vgap)
CardLayout 卡片布局管理器 像一堆卡片堆在一起一样,只显示最上面一张
构造方法
CardLayout()
CardLayout(int hgap,int vgap)
成员方法
first(container target)
last(container target)
previous(container target)
next(container target)
show(container target,String name)
BoxLayout 可以在垂直和水平两个方向摆放GUI;
成员方法
static Box createHorzontalBox() 创建一个水平排列组件的Box容器
static Box createVerticalBox()创建一个竖直排列组件的Box容器
间隔布局美观
Box类中,提供5个方便的静态方法生成这些间隔组件
static Companent createHorizontalGlue()
static Companent createVerticalGlue()
static Companent createHorizontalStrut(int width)
static Companent createVerticalStrut(int height)
基本组件
Button
canvas
checkbox
checkboxGroup
Choice
Frame
Label
List
panel
Scrollbar
Scrollpane
TextArea
TextField
模式对话框
构造方法
Dialog(Frame owner,String title,int modal)
modal 为true表示模式对话框,否则为非模式对话框
文本对话框
FileDialog(Frame owner,String title,boolean modal)
modal:如果指定为FileDialog.LOAD用于打开文件,如果指定为FileDialog.SAVE用于保存文件。
事件处理机制
事件源
事件
事件监听器
注册事件监听器:把一个事件监听器(A)通过某个事件(B)绑定到某个事件源(C)上,当在C上发生了事件B之后,那么事件监听器A的到吗就会自动执行
菜单组件
MenuBar
Menu
PopupMenu
MenuItem
CheckboxMenuItem
组件绘画
paint
update(Graphics g)
repaint()
边栏推荐
- cesium 监听地图缩放或放大来控制地图上添加的内容是否展示
- Decentralized and p2p networks and traditional communications with centralization at the core
- 2021-07-09
- Chain Reading|The latest and most complete digital collection sales calendar-08.02
- Copy large files with crontab
- 深度学习中数据到底要不要归一化?实测数据来说明!
- 操作表 函数的使用
- Linux数据库Oracle客户端安装,用于shell脚本用sqlplus连接数据库
- String常用方法
- Canal reports Could not find first log file name in binary log index file
猜你喜欢
随机推荐
集合 Map
链读好文:Jeff Garzik 推出 Web3 制作公司
Canal reports Could not find first log file name in binary log index file
The complex "metaverse" will be interpreted for you, and the Link Reading APP will be launched soon!
Count down the six weapons of the domestic interface collaboration platform!
Using sqlplus to operate database in shell script
【List练习】遍历集合并且按照价格从低到高排序,
最新最全的数字藏品发售日历-07.26
小程序学习笔记:小程序组件间通信方式
Ten years of sharpening a sword!The digital collection market software, Link Reading APP is officially open for internal testing!
redis---非关系型数据库(NoSql)
作业实验四
毫米波雷达数据集Scorp使用
安装Robotics-toolbox-matlab, for 点云坐标系转换
impdp import data
Set Sources Resources and other folders in the IDEA project
用Pytorch从0到1实现逻辑回归
常用类 BigDecimal
Chained Picks: Starbucks looks at digital collectibles and better engages customers
各个架构指令集对应的机型








