freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

javase_12_gui編程_(參考版)

2025-08-04 17:23本頁面
  

【正文】 //畫橢圓 (50, 220, 200, 50, 20, 20)。 //畫字符串 (50, 100, 200, 50)。 (50, 50, 200, 50)。 (true)。 88 Java高端培訓(xùn) Graphics2D 89 Java高端培訓(xùn) 示例 90 Java高端培訓(xùn) class MyFrame extends Frame { public MyFrame(){ (100, 100, 300, 500)。 //畫圓角矩形 } } 組件重繪 ?在組件大小改變或隱藏后又顯示, AWT線程都會重新繪制組件,組件上原來繪制的圖形也就不復(fù)存在了。 //畫矩形 (50, 160, 200, 50)。 //畫線 (Graphics畫圖 , 50, 70)。 //要先讓組件顯示后,才會返回 Graphics對象,否則會返回 null Graphics g = ()。 (300, 400)。 //創(chuàng)建一個區(qū)域 Canvas canvas = new Canvas()。 提 綱 Content 目標(biāo) ? AWT ?組件和容器 ?布局管理器 ?事件處理 ? 事件源、事件監(jiān)聽器、事件類型 ? 事件監(jiān)聽器接口和事件適配器 ?內(nèi)部類 ? 匿名類在 Java事件處理中的應(yīng)用 ? AWT常用組件 ?Java圖形 ? Graphics類和 Canvas組件 ? paint方法 Java高端培訓(xùn) 84 Graphics ? Graphics 類是所有圖形操作的抽象基類,提供了在組件上進行圖形、文字繪制及顯示圖像等操作方法: ? drawLine(int x1, int y1, int x2, int y2) 畫線 ? drawOval(int x, int y, int width, int height) 畫橢圓 ? drawRect(int x, int y, int width, int height) 畫矩形 ? drawString(String str, int x, int y) 畫字符串 ? drawImage(Image img, int x, int y, ImageObserver observer) 畫圖像 ? fillOval(int x, int y, int width, int height) 填充橢圓 ? fillRect(int x, int y, int width, int height) 填充指定的矩形 ? … ? getGraphics方法來返回一個包含有該組件的屏幕顯示信息的 Graphics類對象 85 Java高端培訓(xùn) Canvas組件 ? Canvas 組件表示屏幕上一個空白矩形區(qū)域,應(yīng)用程序可以在該區(qū)域內(nèi)繪圖。 } return this。 } else { setIcon(secondClsIcon )。 // 獲取路徑 // 按路徑層次賦予不同的圖標(biāo) if ( == 3) { setIcon(thirdIcon)。 DefaultMutableTreeNode node = (DefaultMutableTreeNode) value。 // 第二層圖標(biāo) ,打開節(jié)點用 private static final Icon secondOpnIcon = new ImageIcon((/))。 // 第三層圖標(biāo) private static final Icon thirdIcon = new ImageIcon((/))。 } } JTree渲染器 83 Java高端培訓(xùn) public class TreeNodeRenderer extends DefaultTreeCellRenderer { private static final long serialVersionUID = 1L。 (())。 // 給樹控件添加監(jiān)聽 (new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent evt) { JTree temp = (JTree) ()。 ()。 JScrollPane panel = new JScrollPane(tree)。 (j2seNode)。 (threadNode)。 DefaultMutableTreeNode threadNode = new DefaultMutableTreeNode(Thread)。 DefaultMutableTreeNode swingNode = new DefaultMutableTreeNode(Swing)。 DefaultMutableTreeNode root = new DefaultMutableTreeNode(Java)。 JTree 82 Java高端培訓(xùn) public class JTreeTest { public static void main(String[] args) { JFrame frame = new JFrame()。// 奇數(shù)行設(shè)置為藍(lán)色 } } return cell。 } else { if ((row % 2) == 0) { ()。 // 進行渲染 if (hasFocus) { ()。 } } JTable渲染器 81 Java高端培訓(xùn) public class ColorTableCellRenderer extends DefaultTableCellRenderer { private static final long serialVersionUID = 1L。 arr[2] = ()。 arr[0] = ()。 (0)。 private String gender。 表格動態(tài)數(shù)據(jù)的填充 80 Java高端培訓(xùn) public class Student { private String name。 (200, 200, 500, 200)。 ().add(scrollPane, )。 JFrame f = new JFrame()。 }else{ (50)。 i++) { column = ().getColumn(i)。 for (int i = 0。 JTable table = new JTable(datas, titles)。 JTable 79 Java高端培訓(xùn) Object[][] datas = { { “張三 ”, new Integer(66), 男 }, { “李四 ”, new Integer(82), 女 }, { 王五 , new Integer(82), 男 }, { “趙六 ”, new Integer(82), 女 }, { 錢七 , new Integer(82), 男 }, { “孫八 ”, new Integer(82), 女 }, { “黃十 ”, new Integer(82), 男 } }。 (splitPanel, )。 (200, 300, 500, 300)。 // 設(shè)置分隔器的大小 ,單位為像素 //(5)。 } } JSplitPane分隔窗格 78 Java高端培訓(xùn) // 第一個參數(shù)指定了分隔的方向 , 另外兩個參數(shù)是放置在該分隔窗格的組件 . JSplitPane splitPanel = new JSplitPane(, new JPanel(), new JPanel()) // 設(shè)置分隔器的位置 ,可以用整數(shù) (像素 )或百分比來指定 . (200)。 (true)。 // 將選項窗格放置在面板中 (tabPane)。 (選項卡 3, saledPanel)。 (選項卡 2, new ImageIcon(iconURL2), importPanel)。 JPanel importPanel = new JPanel()。 URL iconURL = ()。// 設(shè)定選項卡放在上部 ClassLoader loader = ().getContextClassLoader()。 } } JTabbedPane 選項卡 77 Java高端培訓(xùn) class MyFrame extends JFrame { public MyFrame() { JTabbedPane tabPane = new JTabbedPane()。 ()。 (new JTextArea(), )。 JFrame frame = new JFrame()。 (button3)。 (button1)。 button3 = new JButton(new ImageIcon(url3))。 //工具條提示 button2 = new JButton(new ImageIcon(url2))。 button1 = new JButton(new ImageIcon(url))。 URL url2 = ().getContextClassLoader().getResource()。 JButton button1, button2, button3。 } } (true)。 } catch (InterruptedException ignoredException) { } (() + 1)。 int maximum = ()。 = button。 private boolean flag = true。 private JProgressBar progressBar。 (true)。 (aJButton, )。 ()。 } })。 } Thread stepper = new BarThread(aJProgressBar, aJButton)。 final JButton aJButton = new JButton(Start)。 71 其它組件 ? JSlider 滑動條 ? JColorChooser 顏色選擇器 ? JProgressBar 進度條 ? JToolBar 工具條 ? JTabbedPane 選項卡 ? JSplitPane 分隔窗格 ? JTable ? JTree Java高端培訓(xùn) 72 JSlider滾動條 73 Java高端培訓(xùn) JProgressBar 進度條 ?進度條:以可視化形式顯示某些任務(wù)進度的組件 74 Java高端培訓(xùn) public class JProgressBarTest { public static void main(String args[]) { final JProgressBar aJProgressBar = new JProgressBar(0, 100)。 (new MouseAdapter() { public void mousePressed(MouseEvent e) { if(()){ ((), (), ())。 (c)。 (a)。 ? JMeunItem對象上有 setEnabled(Boolean)可以設(shè)置啟用 /禁用 菜單。 ?創(chuàng)建一個或多個 JMenuItem對象,再將其加入到各個JMenu對象中 ? 設(shè)置快捷鍵: ? ((, ))。 ? 調(diào)用 JFrame類的 setJMenuBar(JMenuBar mb)方法。 ? JComponent類有一個 setBorder(Border b)方法。 ? Swing中給組件增加滾動條的通用處理機制是-把組件添加進一個滾動面板中。 Swing ?組件和容器 ?布局管理器 ?事件處理 ? 事件源、事件監(jiān)聽器、事件類型 ? 事件監(jiān)聽器接口和事件適配器 ?內(nèi)部類 ? 匿名類在 Java事件處理中的應(yīng)用 ?Swing常用組件 ? Java圖形 ? Graphics類和 paint方法 Java高端培訓(xùn) 53 JLabel ?單行文本組件 ?構(gòu)造方法 ? public JLabel(String text) 使用指定的字符串構(gòu)造一個標(biāo)簽,對齊方式為左對齊 ? public JLabel(String text, int alignment) ? Alignment 對齊方式的值: – 可選值 、 、 ?常用方法 ? public
點擊復(fù)制文檔內(nèi)容
法律信息相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1