当前位置:网站首页>AWT介绍
AWT介绍
2022-07-04 05:35:00 【斯文~】
概述
Java使用AWT和Swing相关的类可以完成图形化界面编程,其中AWT的全称是抽象窗口工具集(Abstract Window Toolkit),它是sun公司最早提供的GUI库,这个GUI库提供了一些基本功能,但这个GUI库的功能比较有限,所以后来sun公司又提供了Swing库。通过使用AWT和Swing提供的图形化界面组件库,java的图形化界面编程非常简单,程序只需要依次创建所需的图形组件,并以合适的方式将这些组件组织在一起,就可以开发出非常美观的用户界面。
当 JDK 1.0发布时, Sun 提供了 一套基本的GUI类库,这个GUI类库希望可以在所有平台下都能运行 , 这套基本类库被称为"抽象窗口工具集 CAbstract Window Toolkit )",它为Java应用程序提供了基本的图形组件 。 AWT是窗口框架,它从不同平台的窗口系统中抽取出共同组件 , 当程序运行时,将这些组件的创建和动作委托给程序所在的运行平台 。 简而言之 ,当使用 AWT 编写图形界面应用 时, 程序仅指定了界面组件的位置和行为,并未提供真正的实现,JVM调用操作系统本地的图形界面来创建和平台 一致的对等体 。
使用AWT创建的图形界面应用和所在的运行平台有相同的界面风格 , 比如在 Windows 操作系统上,它就表现出 Windows 风格 ; 在 UNIX 操作系统上,它就表现出UNIX 风格 。 Sun 希望采用这种方式来实现 " Write Once, Run Anywhere " 的目标 。
AWT继承体系
所有和 AWT 编程相关的类都放在 java.awt 包以及它的子包中, AWT 编程中有两个基类 :Component和 MenuComponent。
Component
:代表一个能以图形化方式显示出来,并可与用户交互的对象,例如 Button 代表一个按钮,TextField 代表 一个文本框等;
MenuComponent
:则代表图形界面的菜单组件,包括 MenuBar (菜单条)、 Menultem (菜单项)等子类;
其中 Container 是一种特殊的 Component,它代表一种容器,可以盛装普通的 Component。
AWT中还有一个非常重要的接口叫LayoutManager ,如果一个容器中有多个组件,那么容器就需要使用LayoutManager来管理这些组件的布局方式。
边栏推荐
- Zzulioj:1201: mode problem
- How to implement lazy loading in El select (with search function)
- ansys命令
- C语言简易学生管理系统(含源码)
- HMS v1.0 appointment.php editid参数 SQL注入漏洞(CVE-2022-25491)
- Appearance of LabVIEW error dialog box
- left_and_right_net正常版本
- Topological sorting and graphical display of critical path
- LC周赛300
- 力扣(LeetCode)184. 部门工资最高的员工(2022.07.03)
猜你喜欢
VB.net 简单的处理图片,黑白(类库——7)
Grounding relay dd-1/60
BeanFactoryPostProcessor 与 BeanPostProcessor 相关子类概述
HMS v1.0 appointment. PHP editid parameter SQL injection vulnerability (cve-2022-25491)
How to get the parent node of all nodes in El tree
Kubernets first meeting
Letter meaning and parameter abbreviation of optical module Daquan
Appearance of LabVIEW error dialog box
Analysis of classical pointer and array written test questions in C language
509. 斐波那契数、爬楼梯所有路径、爬楼梯最小花费
随机推荐
Ping port artifact psping
每周小结(*63):关于正能量
js arguments参数使用和详解
left_and_right_net正常版本
Excel comparator
LC weekly 300
JS arguments parameter usage and explanation
1480. Dynamic sum of one-dimensional array
一键过滤选择百度网盘文件
VB. Net simple processing pictures, black and white (class library - 7)
(4) Canal multi instance use
BUU-Real-[PHP]XXE
LM small programmable controller software (based on CoDeSys) note XXI: error 3703
补某视频网站的js,进行视频解密
Zhanrui tankbang | jointly build, cooperate and win-win zhanrui core ecology
JS flattened array of number shape structure
[high concurrency, high performance and high availability of massive data MySQL practice-7] - memory data drop disk
Impact relay jc-7/11/dc110v
Thread pool: use thread pool to optimize query speed
检漏继电器JY82-2P