文档详情

JAVA图形化界面AWT.ppt

发布:2016-11-18约1.22万字共60页下载文档
文本预览下载声明
User Interface 内 容 UI概述: GUI AWT Swing Container GUI Object 列表 内 容 一个简单的UI应用开发: 如何创建一个框架? 如何在一个框架中安放控件(按纽)? 如何处理各种事件动作事件? 如何处理动作事件? 如何处理窗口事件? 如何处理鼠标事件? 内 容 一些常用GUI Object介绍 对话框 菜单 UI概述 GUI Object? GUI (Graphics User Interface) 图形用户接口 GUI对象是一些可视的对象,一般用于图形用户界面设计,并处理用户接口方面的事件。 AWT ? AWT - Abstract Windowing Toolkit AWT 是Java基本类库的一部分,它在你的Java程序中提供了图形化用户界面,并且能够接收来自键盘,鼠标和其他输入设备的用户输入。 AWT在Java 1.0中对图形化编程提供有限支持的一个包。 使用AWT包,则需要import java.awt.*; Swing? Swing是AWT的一个扩展。 用Swing可以编写采用本地操作系统风格的界面。 使用Swing包,则需要import Java.swing.*; GUI Objects AWT provided Frame Dialog Button Label TextField TextArea List Menu MenuItem MenuBar GUI Objects Swing Provided JFrame JWindow JButton Jpanel JLabel JTextField JTextArea JScrollPane JCheckBox JRadioButton JComboBox Container? Top-lever Container Intermediate Containers Top-lever Container The four top-level Swing containers for Java are: Japplet Jframe Jdialog Jwindow All four provide a getContentPane() method to provide a reference to the associated Container to which GUI object are added. Top-lever Container An applet you would write would extend JApplet. An application you would write that presented a GUI could extend JFrame. A JDialog is usually used in conjunction with a parent JFrame or JDialog A JWindow has no titlebox or window management buttons. Top-Level Container Class Hierarchy Intermediate Containers Swing provides additional classes that are used as intermediate containers and exist only to contain other components. Intermediate Containers General-Purpose JPanel JScrollPane JSplitPane JTabbedPane JToolBar Specialized JInternalFrame JLayeredPane JRootPane A Sample of GUI Objects General Purpose Containers JPanel JScrollPane JSplitPane JTabbedPane JToolBar Selectors JButton JComboBox JList JTextField JMenuItem JCheckBox GUI Objects Class Hierarchy Sample of Methods Inherited by GUI Objects by Component, JComponent, and Container Components getGraphics() paint() processEvent() setEnable(
显示全部
相似文档