当前位置:网站首页>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()
边栏推荐
- 数据库 笔记 创建数据库、表 备份
- 【yolov5训练错误】WARNING: Ignoring corrupted image
- 文章复现:超分辨率网络-VDSR
- 文章复现:超分辨率网络FSRCNN
- 2021-07-09
- 链读 | 最新最全的数字藏品发售日历-07.28
- R绘制图像,图像特征提取
- network security firewall
- Batch add watermark to pictures batch scale pictures to specified size
- Canal 报错 Could not find first log file name in binary log index file
猜你喜欢
随机推荐
网络安全7
ORACLE系统表空间SYSTEM占满无法扩充表空间问题解决过程
【List练习】遍历集合并且按照价格从低到高排序,
R简单统计计算--笔记
文本元素
Decentralized and p2p networks and traditional communications with centralization at the core
链读|最新最全的数字藏品发售日历-08.02
每天一个小知识点
Analysis of the investment value of domestic digital collections
微信小程序wx.writeBLECharacteristicValue汉字转buffer问题
复杂的“元宇宙”,为您解读,链读APP即将上线!
Mini Program Study Notes: Communication between Mini Program Components
cesium rotate image
Using sqlplus to operate database in shell script
wiki confluence 安装
network security firewall
.las转.txt 再转.pcd,编译运行中出现的错误
cesium 旋转图片
【yolov5训练错误】WARNING: Ignoring corrupted image
第十天作业