Graphics User Interfaces

本文详细探讨了GUI(Graphics User Interface)的发展历程、核心原理及应用实践,包括组件层级、消息驱动机制、属性设置与布局管理。通过Java GUI为例,展示了如何使用常见组件、属性和布局方案构建交互式应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Graphics User Interfaces
The world has changed a lot since GUI (Graphics User Interfaces) came to this planet. GUI has become standard user interfaces nowadays no matter what kind of software is. There are a lot of platforms and Operating systems which support GUI. There is also thousands of tools to create GUI applications. The implementations and methods vary, though, the mechanism is analogous.
First, all GUI systems have a lot of containers or components which represents all GUI widgets such as frame, window, button, label, toolbar, menu or dialog. Those components and containers have an inheritance hierarchy and ones which on top of hierarchy tree can hold other components and containers. So you can put label, button on window, and you can put a window on a frame, and so forth.
Second, all GUI systems are message-driven or event-driven, that is, no action would be taken until receiving messages and events which represents user actions. The applications will do nothing, for example, until user clicks some buttons or menus. You, the developers, are only responsible for writing events handling for each widgets which can receive events. The Operating Systems, however, are responsible to detect user actions and translate them into events and send them to your applications.
Third, every widget has their own attributes which specify some appearances or some actions that widgets should act when user sends events to them. Window, for example, has attributes of height, title, size, caption .etc. The widgets can work properly and the GUI is meaningful only you set the rightful attributes of them.
Fourth, containers or components have some layout schemes which is responsible to organize widgets put on them. It is hard to use when menu is on the bottom of window and button is in the text input areas.
So, writing GUI applications is not as difficult as you think, you decide what kinds of contains and components you want use, set attributes for each them, and use a layout scheme to organize them. Then write event handling for each widget. After that you are done almost.


About Java’s GUI
Java follows the common patterns, too.
Some components and containers such as frame, dialog and panel can hold other widgets. There is some Layout manager to help to organize these widgets(BorderLayout, FlowLayout and BoxLayout). There are thousands of attributes for each widget to control all the things you can see and things you cannot as well. For each widgets you can add event listener to them to let them do what you want. So what you have to do when you program with Java GUI is: set attributes for widgets which you want to use, arrange them onto some containers according to some layout schemes. Then write event handling methods for widgets. After that you are done.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值