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

正文內(nèi)容

北大計算機系java講義--第五章java顯示awt-全文預(yù)覽

2025-06-23 18:43 上一頁面

下一頁面
  

【正文】 Arial Courier New Times New Roman 18 20 22 24 26 ourier New 22 各種構(gòu)件的應(yīng)用實例 練習(xí) 與 List類有關(guān)的事件 , 例 :() public boolean handleEvent(Event evt) { switch(){ case : dispose()。 ? repaint()。 case : return action(evt, )。 add(North,b1)。 ()。 ()。 class ButtonsInFrames extends Frame { int a1=0,a2=0。 return true。 default: return (evt)。 return true。 if(visible){ ()。 public void init() { frame=new CustomFrame (Custom Frame Window)。(0)。 repaint()。 (CANVAS,40,40)。 MyCanvas() { color=。 resize(200,250)。 public void init() { setLayout(new BorderLayout())。 ()。 ….。 public class canvas_test extends Applet { MyCanvas mycanvas=new MyCanvas()。 ()。 add(West, new Button(button3))。 import .*。 ?add(button9)。 ?=1。 ?=2。 ?= ? 。 ?add(button4)。 (填充剩余部分 ) (button3,GBC)。 =。 Button button9=new Button(button9)。 Button button5=new Button(button5)。 Button button1=new Button(button1)。 rows cols hspace vspace 32 外觀的管理與制 ?GridBagLayout類和 ? GridBagConstraints類 ?功能 :借助于 GridBagConstraints類 ,實現(xiàn)更靈活的外觀管理 ?每個構(gòu)件后都跟隨一個 GridBagLayout對象實體 ,來決定構(gòu)件的外觀 . ?創(chuàng)建 ? GridBagLayout myLayout=new ? GridBagLayout()。 ?add(“West”, new Button(“西” )。 (button4)。 button4=new Button(Button4)。 add(panel2)。 Button button1,button2,button3,button4。 } 各種構(gòu)件的應(yīng)用實例 TextField 27 0 1 2 4 3 5 4 0 1 5 3 4 外觀的管理與制 28 button1 button2 button4 button3 外觀的管理與制 ?Panel類 (面板 ) ?功能 :容納其他對象 ,安排合理布局 ?創(chuàng)建面板 : ? Panel myPanel=new Panel()。 } 各種構(gòu)件的應(yīng)用實例 TextField 26 public boolean action(Event evt, Object arg) { if( instanceof Button) { repaint()。 public void init() { t=new TextField(,25)。 } 各種構(gòu)件的應(yīng)用實例 CheckBox 24 ?例 :在文本行中輸入 ,并用字符串接受 ,顯示出來 ?類的數(shù)據(jù)構(gòu)成 :Textfield,Button, String ?類的方法構(gòu)成 : ?init(), ?action():接受按鈕事件 ,調(diào)用 paint() ?paint():用 getText()方法得到輸入內(nèi)容 ,并顯示 . 各種構(gòu)件的應(yīng)用實例 TextField 25 import .*。 else if (str==Label2) (Chnage2)。 add(b3)。 b2=new Checkbox(Label2,null,false)。 21 各種構(gòu)件的應(yīng)用實例 CheckBox ?應(yīng)用舉例 ?建立三個復(fù)選框 ,被選中者的標(biāo)簽內(nèi)容變成“ changes” –應(yīng)有的類 :Checkbox –應(yīng)有的方法 : – init:建立復(fù)選框 – action:接受動作事件 – setLabel(“*****”)。 常用的方法 getText()。 CheckboxGroup gr=new CheckboxGroup()。 Button b2=new Button(Button2)。 (Button in Frame)。 ? return true。 add(b1)。 public class button extends Applet { Font font。 ? add(new Button(“取消” )。} } ok Panel 12 () ?事件由包含層次由內(nèi)向外傳遞 . ?每個處理事件的方法要有一個返回值 ,通知是否繼續(xù)向上傳遞 boolean action(Event evt, Object arg) { ……。 add(b)。 boolean action() {…….。 。 4 使用 AWT構(gòu)件 ?已經(jīng)學(xué)過的: ?getFont, ?handleEvent,keyUp ?keyDown,mouseUp, ?mouseDown, ?mouseMove, ?mouseEnter, ?mouseExit, ?mouseDrag, repaint ?setFont, resize ?沒有學(xué)過的: ?action, disable, enable, ?getBackground, ?getForeground, hide, ?inside, isEnable, ?isShowing, isVisible, ?locate, location, ?move, setBackground, ?setForeground, show, ?size 5 列表 按鈕 菜單 container 另一個窗口 窗口,對話框 包含 構(gòu)件的 構(gòu)件 構(gòu)件容器 (container) container 6 包含 構(gòu)件的 構(gòu)件 構(gòu)件容器 (container) import .*。1 第 5章 構(gòu)成用戶界面的窗口環(huán)境 北京大學(xué)計算機系 代亞非 2 構(gòu)成用戶界面的窗口環(huán)境 ? 使用 AWT(Abstract Window Toolkit)構(gòu)件 ? 包含 構(gòu)件的 構(gòu)件 構(gòu)件容器( container) ? 事件的傳遞 ? 各種構(gòu)件的應(yīng)用實例 (一 ) ? 外觀的管理與控制 ? 各種構(gòu)件的應(yīng)用實例 (二 ) ? 總結(jié) 3 使用 AWT構(gòu)件 ?在 AWT的概念中,窗口系統(tǒng)所顯示的各種對象統(tǒng)稱為構(gòu)件: Button, Menu, List等等都是構(gòu)件。隨時隨處都有可能利用Component定義的方法。 public init() { Button b1=new Button(“按鈕” )。 add(b)。 Button b=new Button(exit)。 return true。 ?將 button放到窗口系統(tǒng)中 : ? add(new Button(“確定” )。import 。 b1=new Button(push)。 repaint()。\\例 :不在 applet中的按鈕 class ButtoninFrame { public static void main(String args[]) { Frame myframe=new Frame()。 Button b1=new Button(Button1)。 } } . 19 各種構(gòu)件的應(yīng)用實例 ?一般步驟 : 創(chuàng)建 new 加入 add 響應(yīng) action 處理 20 各種構(gòu)件的應(yīng)用實例 Sports Computer Music Art Sports Computer Music Art min max start 1 New Checkbox(label, null, false)。 New TextField(20)。 new TextArea( “this is a test”,20,40)。 public void init() { b1=new Checkbox(Label1,null,false)。 add(b2)。 if (str==Label1) (Chnage1)。return true。Button button。 add(button)。 (s,40,80)。 public class Panel extends
點擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1