当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

大连理工大学:《Java语言程序设计》课程电子教案(讲稿)第三篇 图形程序设计 第8章 图形程序设计入门

资源类别:文库,文档格式:PDF,文档页数:44,文件大小:431.81KB,团购合买
一、了解Java图形程序设计类 二、使用框架、面板和U1组件 三、理解布局管理器的作用 四、熟悉 Color、font类 五、使用 Graphics类绘图 六、熟悉Java事件
点击下载完整版文档(PDF)

囹形设计 第三常图形程序设计 第8章图形程序设计入门 第9章创建图形用户界面 第10章 applet和高级图形界面

第三篇 图形程序设计 第8章 图形程序设计入门 第9章 创建图形用户界面 第10章 applet和高级图形界面

第8章图形程序设计入门 了解Java图形程序设计类 使用框架、面板和U纽组件 习狸解布局管理景的作用 a熟悉 Color、Font类 使用 Graphi类绘图 标一戴悉」lva事件

第8章 图形程序设计入门 )了解Java图形程序设计类 )使用框架、面板和UI组件 )理解布局管理器的作用 )熟悉Color、Font类 )使用Graphics类绘图 )熟悉Java事件

图形程序设计类的层次( Swing AWTEvent Classes in the javax. swing Layout manager Heavy weight Font FontMetrics Objec Color Panel Applet japplet Graphie Component Container Window Frame Frame Dialog JDialog JComponent Sv in the javax. swing package

图形程序设计类的层次 (Swing) A WTEvent Fo nt FontMetrics Co mp o n e nt G raphi c s Obje ct Color Contai n e r Pa n el Applet Fra m e Di alog Windo w JComp o n e nt JAp plet JFrame JDial o g Swing C ompo nents in the j avax.swing package Lig htweight Heavyweight Classes in the javax.swing package 1 LayoutManager *

JComponent JCheckBoxMenultem JMenultem JMenu Abstract Button IJRadioButtonMenultem JToggleButton CHeckbOx JRad io Button JComponent Kh JEditorPane tComp JTextF ield PAssword Field JLabel JList JJComboBox JPanel JOptionPane JScrollBar JScrollPane JFileChooser POpupmEnu SEparator JSlider TAbbed Pane JRootPane PAne DaoeD. ogressbar TOolBar STAble JTree . JColorChooser JInternalFrame TOoltIp JLayeredPane Tableheader

JComponent JB utto n JMenuItem J Chec kBoxMenuItem A bstractB utton JComponent J Menu .JRadioButtonMenuItem .JToggleButton J Chec kBox JRadioB utto n .JComboBox .JInternalFrame .JLayered Pane .J List .JMenuBar .JOptionPane .JPopupMenu .JProgressBar .J Pane .JScrollBar .JScrollPane .JFileC hooser .JSeparator .JSplitPane .JSlider .JTabbedPane .J Table .JTableHea der .JTextComponent .J TextField .J E ditorPane .JTextArea .JToolBar .JToolTip .JTree .JRoot Pane .J Panel .J Password Field .JColorC hooser .J Label

AWT(Optional) AWTEvent Container 匚Pmek[APp Font Butt Windo FI Fontmetri Dialog FileDialog Text Field Object Color Textcomponer TextA Graph List Component Choice Check Box Layout Manager Check Box Group Canvas Menu component Menuitem Menu Menubar Scrollbar

AWT (Optional) AWTEvent Font FontMetrics Component Graphics Obje ct Color Canvas Button TextCom ponent Lab el List CheckB o x Gro u p CheckB o x Choice Container Pa n el Applet Fra m e Di alog File Dialog Wind o w TextFiel d TextArea Men uCo m ponent MenuItem MenuBar Menu Scrollbar LayoutManager

框架 G要创建一个用户界面,需要创建一个 框架或 applet来存放用户界面组件。 FI rame Pull-down menus Applet Pull-down menus Panel Panel User Interface Components (un) User Interface User Interface Components Panel Panel Panel User Interface User Interface Panel Panel Panel Components Components panel

框架 )要创建一个用户界面,需要创建一个 框架或applet来存放用户界面组件。 Frame Pull-down Menus User Interface Components (UI) Panel Panel Panel UI Panel UI Panel UI Applet Panel User Interface Components Panel User Interface Components Panel User Interface Components Panel User Interface Components panel Pull-down Menus

Creating Frames import javax. swing. *i public class MyFrame public static void main(string[] args) JFrame frame new JFrame("Test Frame") frame setsize(400, 300)i frame. setvisible(true) //frame setDefaultcloseOperation( JFrame EXIT ON CLOSE) Run

Creating Frames import javax.swing.*; public class MyFrame { public static void main(String[] args) { JFrame frame = new JFrame("Test Frame"); frame.setSize(400, 300); frame.setVisible(true); // frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE); } } Run

框架居中 默认情况下,框架在屏幕的左上角显示。要 在指定位置显示框架,需要使用 Jframe类 中的 setlocation(x,y)方法.该方法 把框架的左上角放置在位置(X,y)处 要把框架放置在屏幕上居中的位置,需要知 道屏幕和框架的高和宽,以便确定框架左上 角的坐标

框架居中 默认情况下,框架在屏幕的左上角显示。要 在指定位置显示框架,需要使用JFrame类 中的 setLocation(x, y) 方法. 该方法 把框架的左上角放置在位置 (x, y)处. 要把框架放置在屏幕上居中的位置,需要知 道屏幕和框架的高和宽,以便确定框架左上 角的坐标

框架居中 Scree Frame frameHeight屏幕高度 screen Width 屏幕宽度 CenterFrame Run

框架居中 screen H scre e n Width frameHeight screen Width (x, y) Fr a m e S creen 屏幕宽度 屏幕高度 CenterFrame Run

Adding Components into a frame // Add a button into the frame frame. getContentPane(). add new JButton("OK")) MyFrameWithComponents Run

Adding Components into a Frame // Add a button into the frame frame.getContentPane().add( new JButton("OK")); MyFrameWithComponents Run

点击下载完整版文档(PDF)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共44页,可试读15页,点击继续阅读 ↓↓
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有