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

正文內容

第6章回顧applet(文件)

2025-08-07 12:22 上一頁面

下一頁面
 

【正文】 Layout(new BorderLayout())。 public int getY() :返回發(fā)生鼠標事件的 Y坐標。 import .*。 public void init() { addMouseMotionListener (this)。 posy = ()。 ? 監(jiān)聽者接口是 KeyListener – public void keyPressed(KeyEvent e) 某個鍵按下時執(zhí)行。 import .*。 int squareTop, squareLeft。 squareColor = 。 int height = getSize().height。 (squareColor)。B39。 repaint()。g39。R39。 repaint()。k39。 if (key == ) { squareLeft = 8。 if (squareLeft getSize().width 3 SQUARE_SIZE) squareLeft = getSize().width 3 SQUARE_SIZE。 repaint()。 } } public void keyReleased(KeyEvent evt) { } } 課堂練習 ? 編 Applet程序在標簽中顯示輸入按鍵的編碼值。 ⑶ 創(chuàng)建菜單子項( MenuItem)加入菜單項 例: MenuItem mi_Edit_Copy = new MenuItem(復制 )。例如: MenuItem mi_File_Open = new MenuItem(打開 , new MenuShortcut(39。 (new MenuShortcut(39。 ⑸ 各菜單子項注冊動作事件監(jiān)聽者 例如: (this)。 import .*。 MenuBar menubar = new MenuBar()。 MenuItem open = new MenuItem(open, new MenuShortcut())。 (quit)。 (this)。 } public void actionPerformed(ActionEvent e) { if (()==Quit) { dispose()。 ( 2)創(chuàng)建若干菜單項并通過執(zhí)行彈出菜單的 add方法將它們加入彈出菜單;給每個菜單項注冊動作事件監(jiān)聽者,并編寫相應的處理程序。 import .*。 public void init() { popup = new PopupMenu(Color)。 i++) { MenuItem mi = new MenuItem(labels[i])。 (new MouseAdapter() { public void mousePressed(MouseEvent e) { lastx = ()。 int x = (), y = ()。 lasty = y。 ()) (this, (), ())。 (())。 else if ((Blue)) color = 。 模式對話框與非模式對話框 ? 模式對話框在顯示時將阻塞該應用的其它操作,要求用戶必須回答;而非模式對話框用戶可以不理會,繼續(xù)其它操作。 public class TestDialog extends Frame { Button change=new Button(Change Color)。 public TestDialog () { super(Parent)。 (new ActionListener(){ public void actionPerformed(ActionEvent e) { my=new Dialog(,Select color,true)。 (Center,m)。 } })。 setBackground(())。該類的構造方法有 3個: ? FileDialog(Frame parent) ? FileDialog(Frame parent, String title) ? FileDialog(Frame parent, String title, int mode) :創(chuàng)建一個對話框, mode取值為 ,決定對話框是打開還是保存文件。例如用戶輸入姓名 flyhorse ,則顯示消息 “ 你好, flyhorse, 歡迎你使用 java 編程! ” ,并能正常關閉窗口。 。在界面中安排一個標簽顯示單詞,另有 “ 上一個 ” 、 “ 下一個 ” 兩個按鈕實現(xiàn)單詞的前后翻動。 作業(yè) 1)創(chuàng)建帶有標簽和文本域的窗體。 } 例 721 續(xù) public static void main(String a[]) { new TestDialog()。 setVisible(true)。 (300,200)。 } })。 m=new ColorPanel()。 Button b = new Button(確定 )。 boolean isModal() setModal(boolean isModal) 例 721 將例 715的顏色面板放入一個對話框,給窗體設置背景顏色 import .*。 } } 2. 深入理解事件處理模型 對話框的創(chuàng)建 ? 對話框必須依托一個 Frame。 } else if ((Red)) color = 。 } public void actionPerformed(ActionEvent e) {String name =((MenuItem)()).getLabel()。 } public void processMouseEvent(MouseEvent e) { if ((popup != null) amp。 (lastx, lasty, x, y)。 } })。 (mi)。 for(int i = 0。 protected Color color = 。 例 720 一個畫圖程序,可以通過彈出菜單選擇畫筆顏色,通過鼠標拖動畫線 import .*。 } } public static void main(String a[]) { new Menudemo()。 setSize(300, 300)。 ()。 (open)。 Menu file = new Menu(File)。 public Menudemo() { ta=new TextArea(30,60)。 例 718 一個簡單的菜單 import .*。))。))。 ? 使用 Menu的 addSeparator()方法可以在各菜單項之間可以加入分隔線。 //創(chuàng)建一個空的菜單條 MenuBar ⑵ 創(chuàng)建不同的菜單項( Menu)并加入到菜單條中 例: Menu menuEdit = new Menu(編輯 )。 if (squareTop getSize().height 3 SQUARE_SIZE) squareTop = getSize().height 3 SQUARE_SIZE。 } else if (key == ) { squareTop = 8。 repaint()。 repaint()。K39。r39。 repaint()。G39。b39。 } public void keyTyped(KeyEvent evt) { char ch = ()。 (1,1,width3,height3)。 } public void paint(Graphics g) { ()。 squareTop = getSize().height / 2 SQUARE_SIZE / 2。 public class KeyboardDemo extends Applet implements KeyListener{ static final int SQUARE_SIZE = 20。 – public void keyTyped(KeyEvent e) 按鍵被敲擊。 } public void mouseDragged(MouseEvent event) { } } 一個鼠標位置跟蹤程序,在當前位置畫紅色小圓 (續(xù) 2) 學生練習 ? 編 Applet在鼠標所到之處繪線 。 (posxRADIUS, posyRADIUS, RADIUS * 2, RADIUS * 2)。 public class extends Applet implements MouseMotionListener { private static final int RADIUS = 7。
點擊復制文檔內容
公司管理相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1