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

正文內(nèi)容

java語言程序設(shè)計(jì)基礎(chǔ)第2版applet程序設(shè)計(jì)ppt(編輯修改稿)

2024-11-12 16:19 本頁(yè)面
 

【文章內(nèi)容簡(jiǎn)介】 56 CardLayout的常用方法 ? first(Container parent)//顯示第一個(gè)被添加的組件 ? next(Container parent)//顯示當(dāng)前組件之后被添加的 //組件 ? previous(Container parent)//顯示當(dāng)前組件之前被添 //加的組件 ? last(Container parent)//顯示最后一個(gè)被添加的組件 ? show(Container parent,String name)//顯示以給擬定 //名稱命名的組件 2021/11/10 57 在 Applet中使用 CardLayout舉例 import .*。 import .*。 import .*。 public class CardLayoutTest extends Applet implements ActionListener{ Panel p1,p2,p3,centerPane。 CardLayout card。 Button firstButton,lastButton,nextButton, previousButton。 List cardList。 2021/11/10 58 public void init(){ setLayout(new BorderLayout())。 Label lab1 = new Label(first)。 p1 = new Panel()。 (lab1)。 Label lab2 = new Label(Second)。 p2 = new Panel()。 (lab2)。 Label lab3 = new Label(Third)。 p3 = new Panel()。 (lab3)。 centerPane = new Panel()。 card = new CardLayout()。 (card)。 2021/11/10 59 (p1,first)。 (p2,second)。 (p3,third)。 add(centerPane, )。 Panel bottomPane = new Panel()。 firstButton = new Button(first)。 (this)。 (first)。 nextButton = new Button(next)。 (this)。 (next)。 2021/11/10 60 previousButton = new Button(previous)。 (this)。 previousButton. setActionCommand(previous)。 lastButton = new Button(last)。 (this)。 (last)。 cardList = new List(3,false)。 (first)。 (second)。 (third)。 (this)。 2021/11/10 61 (firstButton)。 (nextButton)。 (previousButton)。 (lastButton)。 (cardList)。 add(bottomPane,)。 } public void actionPerformed(ActionEvent e){ if(() instanceof List){ String s = ()。 (centerPane,s)。 }else{ String mand = ()。 2021/11/10 62 if((first)){ (centerPane)。 } else if((next)){ (centerPane)。 } else if((previous)){ (centerPane)。 } else if((last)){ (centerPane)。 } } } } 2021/11/10 63 示例說明( 1) ?使用 Applet執(zhí)行 CardLayoutTest,結(jié)果如下圖所示 centerPane 使用了 CardLayout bottomPane 使用了默認(rèn)的 FlowLayout 整個(gè) Applet使用了 BorderLayout 2021/11/10 64 示例說明( 2) ?當(dāng)前的舉例中使用到了事件處理,bottomPane中的四個(gè) bottom和一個(gè) list在被選中后執(zhí)行了不同的事件(下一講中將詳細(xì)說明) –“ first”按鈕按下時(shí)執(zhí)行 ()方法 –“ next”按鈕按下時(shí)執(zhí)行 ()方法 –“ previous”按鈕按下時(shí)執(zhí)行 ()方法 –“ last”按鈕按下時(shí)執(zhí)行 ()方法 –當(dāng)選中 list中某項(xiàng)時(shí)執(zhí)行 ()方法。 2021/11/10 65 事件處理模型中的三種對(duì)象 ?事件源:引發(fā)事件的組件。 ?事件:發(fā)生在用戶界面上的,用戶對(duì)某組件產(chǎn)生的操作。 ?事件監(jiān)聽器:對(duì)特定的事件源產(chǎn)生的事件進(jìn)行處理的對(duì)象。 2021/11/10 66 事件處理模型 ? Java中的 GUI事件處理模型稱為:事件授權(quán)模型 事件源 事件監(jiān)聽器 事件 事件源將用戶對(duì)其產(chǎn)生的各種事件委托給一個(gè)或多個(gè)事件監(jiān)聽器 用戶操作 產(chǎn)生 將事件傳遞給監(jiān)聽器, 同時(shí)引發(fā)監(jiān)聽器對(duì)事件的處理 2021/11/10 67 事件類 ?與 AWT有關(guān)的所有事件類都是,而 AWTEVent是,如下: AWTEvent TextEvent ItemEvent ComponentEvent AdjustmentEvent ActionEvent WindowEvent PointEvent InputEvent FocusEvent ContainerEvent keyEvent MouseEvent 2021/11/10 68 事件監(jiān)聽器 ?所有的事件監(jiān)聽器都是接口 ? AWT中的監(jiān)聽器接口如下 ActionListener AdjustmentListener ItemListener ComponentListener MouseListener WindowListener MouseMotionListener ContainerListener KeyListener TextListener FocusListener 2021/11/10 69 事件適配器類 ?為了簡(jiǎn)化監(jiān)聽器的實(shí)現(xiàn), Java為一些監(jiān)聽器接口提供了適配器類。 ?事件適配器類 – ComponentAdapter – ContainerAdapter – FocusAdapter – KeyAdapter – MouseAdapter – MouseMotionAdapter – WinodwAdapter 2021/11/10 70 事件、監(jiān)聽器及組件間的關(guān)聯(lián) ?任何組件只和特定類型的事件相關(guān)聯(lián),同時(shí)任何監(jiān)聽器只能監(jiān)聽一種類型的事件 2021/11/10 71 ActionEvent ?可產(chǎn)生 ActionEvent的組件 – Button、 List、 MenuItem、 TextField ?監(jiān)聽 ActionEvent的監(jiān)聽器 – ActionListener ?監(jiān)聽器方法 – actionPerformed(ActionEvent e) 2021/11/10 72 AdjustmentEvent ?可產(chǎn)生 AdjustmentEvent的組件 – Srollbar ?監(jiān)聽 AdjustmentEvent的監(jiān)聽器 – AdjustmentListener ?監(jiān)聽器方法 – adjustmentValueChanged(AdjustmentEvent e) 2021/11/10 73 ComponentEvent ?可產(chǎn)生 ComponentEvent的組件 – Button、 Canvas、 Checkbox、 Choice、 Dialog、 Frame、Label、 List、 Panel、 ScrollBar、 ScrollPane、 TextArea、TextField、 Window ?監(jiān)聽 ComponentEvent的監(jiān)聽器 – ComponentListener ?監(jiān)聽器方法 – ponentHidden(ComponentEvent e) – ponentMoved(ComponentEvent e) – ponentResized(ComponentEvent e) – ponentShown(ComponentEvent e) 2021/11/10 74 ContainerEvent ?可產(chǎn)生 ContainerEvent的組件 – Dialog、 Frame、 Panel、 ScrollPane、 Window ?監(jiān)聽 ContainerEvent的監(jiān)聽器 – ContainerListener ?監(jiān)聽器方法 – ponentAdded(ContainerEvent e) – ponentRemoved(ContainerEvent e) 2021/11/10 75 FocusEvent ?可產(chǎn)生 FocusEvent的組件 – Button、 Canvas、 Checkbox、 Choice、 Dialog、Frame、 Label、 List、 Panel、 ScrollBar、ScrollPane、 TextArea、 TextField、 Window ?監(jiān)聽 FocusEvent的監(jiān)聽器 – FocusListener ?監(jiān)聽器方法 – focusGained(FocusEvent e) – focusLost(FocusEvent e) 2021/11/10 76 ItemEvent ?可產(chǎn)生 ItemEvent的組件 – Checkbox、 Choice、 List、 CheckboxMenuItem ?監(jiān)聽 ItemEv
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1