当前位置:网站首页>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来管理这些组件的布局方式。
边栏推荐
- Design and implementation of tcp/ip series overview
- 19. Framebuffer application programming
- VB.net 调用FFmpeg简单处理视频(类库——6)
- Grounding relay dd-1/60
- gslb(global server load balance)技术的一点理解
- BUU-Crypto-Cipher
- Simulink and Arduino serial port communication
- 简易零钱通
- Programmers don't talk about morality, and use multithreading for Heisi's girlfriend
- Introduction To AMBA 简单理解
猜你喜欢
BUU-Real-[PHP]XXE
JS flattened array of number shape structure
Overview of relevant subclasses of beanfactorypostprocessor and beanpostprocessor
Arc135 C (the proof is not very clear)
Upper computer software development - log information is stored in the database based on log4net
[microservice] Nacos cluster building and loading file configuration
input显示当前选择的图片
【QT】制作MyComboBox点击事件
配置交叉编译工具链和环境变量
The data mark is a piece of fat meat, and it is not only China Manfu technology that focuses on this meat
随机推荐
BUU-Reverse-easyre
Introduction to AMBA
Signification des lettres du module optique et abréviation des paramètres Daquan
Appearance of LabVIEW error dialog box
transformer坑了多少算力
BUU-Crypto-[HDCTF2019]basic rsa
Flink1.13 SQL basic syntax (I) DDL, DML
Arc135 C (the proof is not very clear)
Etcd database source code analysis - initialization overview
509. 斐波那契数、爬楼梯所有路径、爬楼梯最小花费
[microservice] Nacos cluster building and loading file configuration
How to implement lazy loading in El select (with search function)
冲击继电器JC-7/11/DC110V
VB.net 调用FFmpeg简单处理视频(类库——6)
Nodejs learning document
Redis realizes ranking function
js如何将秒转换成时分秒显示
Penetration tool - sqlmap
What are the reasons for the frequent high CPU of ECS?
Evolution of system architecture: differences and connections between SOA and microservice architecture