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

正文內容

java語言程序設計(applet、用戶界面設計)ppt-資料下載頁

2025-01-19 07:57本頁面
  

【正文】 //(new BorderLayout())。 (new JButton(Button 1 (NORTH)), )。 (new JButton(2 (CENTER)), )。 (new JButton(Button 3 (WEST)), )。 (new JButton(LongNamed Button 4 (SOUTH)), )。 (new JButton(Button 5 (EAST)), )。 82 布局管理 ? CardLayout () ? 兩個或多個組件共享相同的顯示空間,在不同的時間顯示不同的組件 83 布局管理 ? GridBagLayout () ? 最精細、最靈活的布局管理 ? 將空間劃分為由行和列組成的網格單元,每個單元放一個組件,網格單元大小可以不同 (寬度和高度 ) 84 布局管理 ? BoxLayout () ? 將組件放在一行或一列 JPanel jpv = new JPanel()。 (new BoxLayout(jpv, ))。 for(int i = 0。 i 5。 i++) (new JButton( + i))。 JPanel jph = new JPanel()。 (new BoxLayout(jph, ))。 for(int i = 0。 i 5。 i++) (new JButton( + i))。 Container cp = getContentPane()。 (, jpv)。 (, jph)。 容器的嵌套 (面板的嵌套,相互包含 ) 85 第五章 圖形用戶界面設計 1. 概述 2. 事件處理 3. 基本控制組件 4. 布局設計 5. 常用容器組件 86 概述 ? 容器 ? 可包含其他組件和容器 ? Container類的子類 ? 無邊框容器 : Panel, Applet ? 有邊框容器 : Window, Frame, Dialog, FieldDialog ? 可自動處理滾動操作的容器 : Scrollpane Container ScrollPane Frame FileDialog Panel Window Dialog Applet 87 容器 ? 常用方法 ? 添加組件 : add() ? 獲取制定的組件 ? getComponent(int x, int y) ? getComponent(int index) ? 從容器中移出組件 ? remove(Component c) ? remove(int index) ? removeAll() ? 設置容器布局 : setLayout() 88 容器 ? 面板 (Panel) ? 無邊框容器 ? 順序布局 (FlowLayout) ? Applet子類 89 窗口和菜單 ? : 最頂層容器 ? Window(Frame f) ? show() ? BorderLayout布局 ? : 有邊框容器 ? 構造方法 ? Frame() ? Frame(String title) ? BorderLayout布局 ? 常用方法 ? getTitle() ? setTitle(String s) ? setVisible(boolean b) ? setBounds(int a, int b, int width, int height) ? setBackground(Color c) ? pack() ? setSize(int width, int height) ? dispose() ? add() ? remove() 90 使用 Frame容器的例子 import .*。 import .*。 public class Exam5_18 { public static void main(String args[]) { MyFrame mf = new MyFrame()。 } } class MyFrame extends Frame implements ActionListener, MouseListener, WindowListener { Button but。 String str。 String mouseClickCnt = “單擊” 。 Dimension currentPos = new Dimension()。 int clickCnt = 0。 MyFrame() { super(“我制作的窗口” )。 but = new Button(“按鈕” )。 setLayout(new FlowLayout())。 add(but)。 (this)。 addMouseListener(this)。 addWindowListener(this)。 pack()。 show()。 } 91 使用 Frame容器的例子 public void paint(Graphics g) { str = “單擊了” + clickCnt + “次按鈕” 。 (str, 10 ,40)。 (“鼠標” + mouseClickCnt + “位置 :(” + + “,” + + “)”, 10, 70)。 } public void actionPerformed(ActionEvent e) { if(() == but) { clickCnt ++。 repaint()。 } } public void mouseClicked(MouseEvent e) { = ()。 = ()。 if(() == 1) mouseClickCnt = “單擊” 。 else mouseClickCnt = “雙擊” 。 repaint()。 } 92 使用 Frame容器的例子 public void mousePressed(MouseEvent e) { 。 } public void mouseReleased(MouseEvent e) { 。 } public void mouseEntered(MouseEvent e) { 。 } public void mouseExited(MouseEvent e) { 。 } public void windowClosing(WindowEvent e) { dispose()。 (0)。 } public void windowOpened(WindowEvent e) { 。 } public void windowClosed(WindowEvent e) { 。 } public void windowIconified(WindowEvent e) { 。 } public void windowDeiconified(WindowEvent e) { 。 } public void windowActivated(WindowEvent e) { 。 } public void windowDeactivated(WindowEvent e) { 。 } } 93 菜單組件 ? ? MenuBar() ? setMenuBar(菜單對象 ) ? ? ? ? MenuComponent MenuBar CheckboxMenuItem PopupMenu MenuItem Menu 94 使用菜單組件的例子 import .*。 import .*。 public class Exam5_19 extends Frame implements ActionListener, ItemListener { TextField text。 public Exam5_19() { super(“我的菜單窗口” )。 setSize(300, 200)。 } public void init() { MenuBar myB = new MenuBar()。 setMenuBar(myB)。 Menu m1 = new Menu(“文件” )。 (new MenuItem(“打開” ))。 MenuItem m11 = new MenuItem(“保存” )。 (false)。 (m11)。 ()。 (“退出” )。 (this)。 (m1)。 95 使用菜單組件的例子 Menu m2 = new Menu(“編輯” )。 (“復制” )。 Menu m21 = new Menu(“顏色” )。 (“前景色” )。 (“背景色” )。 (this)。 (m21)。 ()。 CheckboxMenuItem mycmi = new CheckboxMenuItem(“全選” )。 (this)。 (mycmi)。 (this)。 (m2)。 Menu m3 = new Menu(“幫助” )。 (“關于” )。 (this)。 (m3)。 text = new TextField()。 add(“South”, text)。 } 96 使用菜單組件的例子 public static void main(String args[]) { Exam5_19 myMenu = new Exam5_19()。 ()。 (true)。 } public void itemStateChanged(ItemEvent e) { (“狀態(tài)改變” )。 } public void actionPerformed(ActionEvent e) { (())。 if (() == “退出” ) (0)。 } } 97 對話框 ? ? 有邊框和標題,可對立使用的容器 ? Dialog(Frame f) ? Dialog(Frame f, boolean b) ? Dialog(Frame f, String s) ? Dialog(Frame f, String s, boolean b) ? setTitle()/getTitle() ? setModal()/setSize()/setVisible() ? 操作步驟 ? 創(chuàng)建一個窗口類 ? 創(chuàng)建一個對話框類 ? 設置對話框大小 ? 創(chuàng)建主類,啟動和初始化窗口和對話框類 98 對話框 ? ? Dialog類的子類 ? 構造方法 ? FileDialog(Frame f) ? FileDialog(Frame f, String s) ? FileDialog(Frame f, String s, int m) ? 常用方法 ? getDirectory() ? setDirectory() ? setFile() 99 關于 Swing的設計 100 界面設計 ? 設計流程 1. 頂層容器 ? JFrame對象 ?主窗口 ? JDialog對象 ?二級窗口 ? JApplet對象 ?applet程序在瀏覽器窗口中的顯示區(qū)域 2. 內容面板 ? JFrame f = new JFrame(“Swing1)。 JLabel label = new JLabel(Hello!)。 ().add(label)。 ? 面板的嵌套 (面板包含面板 ) ? 設計布局 3. 在內容面板中添加組件 101 界面設計 Frame 內容面板 內容面板 內容面板 TextField Slider Combox TextField Slider Combox 102 界面設計 103 應用實例 ? 應用實例 —菜單的構造 JMenuBar menuBar。 JMenu menu, submenu。 JMenuItem menuItem。 JCheckBoxMenuItem cbMenuItem。 JRadioButtonMenuItem rbMenuItem。 menuBar = new JMenuBar()。 menu = new JMenu(A Menu)。
點擊復制文檔內容
教學課件相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1