当前位置:网站首页>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()
边栏推荐
猜你喜欢
链读精选:星巴克着眼于数字收藏品并更好地吸引客户
matlab中的常用的类型转换
链读好文:Jeff Garzik 推出 Web3 制作公司
【yolov5训练错误】WARNING: Ignoring corrupted image
Set Sources Resources and other folders in the IDEA project
The latest and most complete digital collection sales calendar-07.27
Analysis of the investment value of domestic digital collections
深度学习模型训练前的必做工作:总览模型信息
索引笔记【】【】
训练集Loss收敛,但是测试集Loss震荡的厉害?
随机推荐
Chain Reading Good Article: Jeff Garzik Launches Web3 Production Company
latex图片排版技巧总结
opencv
IDEA 项目中设置 Sources Resources 等文件夹
Bifrost micro synchronous database implementation services across the library data synchronization
Database Notes Create Database, Table Backup
win12 modify dns script
OSPF实验
Module build failed TypeError this.getOptions is not a function报错解决方案
转载fstream,ifstream的详细用法
索引笔记【】【】
Knowledge Distillation Thesis Learning
cesium rotate image
使用Tenserboard可视化深度学习训练过程
【写下自用】每次都忘记如何train?记录如何训练自己的yolov5
第五次实验
毫米波雷达基础概念学习
链读精选:星巴克着眼于数字收藏品并更好地吸引客户
PCL点云配准--ICP or keypoints+features
Canal 报错 Could not find first log file name in binary log index file