下载此文档

11 图形用户界面.ppt


文档分类:IT计算机 | 页数:约71页 举报非法文档有奖
1/71
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/71 下载此文档
文档列表 文档介绍
第11章图形用户界面
GUI组件简介
程序框架
事件处理
布局管理器
基本Swing组件
高级Swing组件
习题
GUI组件简介


Container

Panel
Window
Applet
JApplet
Frame
Dialog
JFrame
JDialog
ponent
Swing组件
AbstractButton
JMenuItem
JButton
JToggleButton
JCheckBox
JRadioButton
JCheckBoxMenuItem
JMenu
JRadioButtonMenuItem
JEditorPane
JTextArea
JTextField
JPasswordField
JPanel、JLabel、JComboBox、JList、JMenuBar、JPopupMenu、JOptionPane、JScrllPane、JSlider、JProgressBar
JFileChooser、JColorChooser、JTree......
程序框架
要创建一个图形用户界面,首先需要创建一个特殊的窗口来容纳用户界面组件。
Java语言中,这个特殊的窗口一般是一个应用程序框架或applet。
创建应用程序框架
JFrame的构造方法:
public JFrame()
//创建一个没有标题的框架
public JFrame(String title)
//创建一个带有指定标题的框架
例11-1 创建应用程序框架
源代码
运行
添加组件
例11-2 添加组件
例11-3 直接调用方法add()添加组件
源代码
运行
源代码
运行
事件处理
事件和事件源
事件监听器
事件监听适配器
事件和事件源



ActionEvent
AdjustmentEvent
ComponentEvent
ItemEvent
TextEvent
FocusEvent
InputEvent
WindowEvent
ContainerEvent
PaintEvent
KeyEvent
MouseEvent
ListSelectionEvent
ChangeEvent
事件和事件源(续)
JButton 点击按钮 ActionEvent
JTextField 在文本域按回车键 ActionEvent
JCheckBox 点击复选框 ActionEvent、ItemEvent
JRadioButton 点击单选按钮 ActionEvent、ItemEvent
JComboBox 选定选项 ActionEvent、ItemEvent
JList 选定选项 ListSelectionEvent
JMenuItem 选定菜单项 ActionEvent、ItemEvent
JSlider 滑动滑块 ChangeEvent
Window 窗口打开、关闭等 ponent 点击或移动鼠标 ponent 按下或释放键 KeyEvent
Container 在容器中添加或删除组件 ponent 组件获得或失去焦点 ponent 组件移动、ponentEvent
事件监听器
组件(事件源)
事件
监听器
触发事件
注册
操作
用户
通知
事件监听器(续)
ActionEvent ActionListener actionPerformed(ActionEvent e) addActionListener()
ItemEvent ItemListener itemStateChanged(ItemEvent e) addItemListener()
MouseEvent MouseListener mouseClicked(MouseEvent e) addMouseListener() mousePressed(MouseEvent e) mouseReleased(MouseEvent e)
mouseEntered(MouseEvent e) mouseExited(MouseEvent e)
MouseEvent MouseMotionListene

11 图形用户界面 来自淘豆网m.daumloan.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数71
  • 收藏数0 收藏
  • 顶次数0
  • 上传人中国课件站
  • 文件大小0 KB
  • 时间2011-09-06
最近更新