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

正文內(nèi)容

基于java的圖形用戶(hù)界面及其應(yīng)用-預(yù)覽頁(yè)

 

【正文】 裝成一個(gè)整體。它們都是在 AWT 組件名前面加一個(gè)英文字母 J( J組件)。這些從JComponent 抽象類(lèi)繼承的組件類(lèi)是一個(gè)實(shí)例,必須放置在象 JFrame, 等類(lèi)的頂級(jí)容器中成為它們的子組件,而頂級(jí)容器 又是父容器。比如說(shuō),設(shè)計(jì)一個(gè)簡(jiǎn)單的計(jì)算器,或一個(gè)文本編輯器等等。那么,在什么 時(shí)候應(yīng)該使用布局管理器?應(yīng)選擇哪種布局管理器?又該怎樣使用布局管理器呢? 如果寫(xiě)的是 GUI 程序,在使用 AWT/Swing 組件時(shí)就不應(yīng)硬性設(shè)置組件的大小和位置,而應(yīng)該使用 Java 的布局管理器( LayoutManager)來(lái)設(shè)置和管理可視組件的大小和位置,否則就有可能造成布局混亂。也就是說(shuō),容器只管將其他組 件放入其中,而不管這些組件是如何放置的。然后 LayoutManager 類(lèi)就可以通過(guò)這些信 息來(lái)實(shí)際布局其中的組件了。如圖 34 所示: North West Center East South 圖 34 邊界布局 例如: class MyPanel extends Jpanel {setLayout(new BorderLayout())??梢酝ㄟ^(guò)指定 BorderLayout 類(lèi)中的 CENTER, NORTH, SOUTH, EAST, WEST 常量來(lái)添 加組件。在 Java中則是定義了一個(gè)普通的、可擴(kuò)充的事件機(jī)制,這種機(jī)制能夠: (1)對(duì)事件類(lèi)型和傳遞的模型的定義和擴(kuò)充提供一個(gè)公共框架,并適合于廣泛的應(yīng)用。 (5)事件機(jī)制本身不依賴(lài)于復(fù)雜的開(kāi)發(fā)工具。實(shí)現(xiàn)了事件監(jiān)聽(tīng)者接口中一些或全部方法的類(lèi)就是事件監(jiān)聽(tīng)者。有時(shí),事件監(jiān)聽(tīng)者不能直接實(shí)現(xiàn)事件監(jiān)聽(tīng)者接口,或者還有其它的額外動(dòng)作時(shí),就要在一個(gè)源與其它一個(gè)或多個(gè)監(jiān)聽(tīng)者之間插入一個(gè)事件適配器類(lèi)的實(shí)例,來(lái)建立它們之間的聯(lián)系。授權(quán)型事件模式就是把對(duì)所引發(fā)事件的處理任務(wù)全部授權(quán)給這些獨(dú)立的來(lái)進(jìn)行處理 四 一個(gè)基于 JAVA 的圖形用戶(hù)界面實(shí)例的設(shè)計(jì)與實(shí)現(xiàn) (一)運(yùn)行環(huán)境配置 本程序的運(yùn)行環(huán)境是 ,安裝在 d 盤(pán),其配置如下: ( 1) 如果你的操作系統(tǒng)是 Win 98,可以用記事本直接編輯 ,添加下面命令行: PATH=d:\\bin SET JAVA_HOME=d:\ SET CLASSPATH=.。右鍵單擊 我的電腦 ,在彈出菜單中選擇 屬性 → 系統(tǒng)特性 → 高級(jí) → 環(huán)境變量 , 彈出環(huán)境變量對(duì)話框,就可以編輯系統(tǒng)的環(huán)境變量了。如圖 41 所示:( windows2020 中的開(kāi)始菜單) 圖 41 Windows2020系統(tǒng) 開(kāi)始菜單 而在本程序中采用的框架方式來(lái)實(shí)現(xiàn),而不在是如上的菜單。如下: text: ActionListener textListener=new ActionListener() {public void actionPerformed(ActionEvent e) {…}} establish ActionListener estListener=new ActionListener() 9 {public void actionPerformed(ActionEvent e) {… }} search ActionListener seaListener=new ActionListener() {public void actionPerformed(ActionEvent e) {… }} help ActionListener helpListener=new ActionListener() {public void actionPerformed(ActionEvent e) {… }} carryout ActionListener carryListener=new ActionListener() {public void actionPerformed(ActionEvent e) {… }} 對(duì)于上述方法,是采用 JAVA 中的匿名內(nèi)部類(lèi)進(jìn)行。內(nèi)部類(lèi)同 JAVA 中的訪問(wèn)控制,以及安全性方面的交互也不明顯。其它的幾個(gè)匿名內(nèi)部類(lèi)都可以是和上面的方法一樣的。當(dāng)用戶(hù)用鼠標(biāo)點(diǎn)擊菜單項(xiàng)或子項(xiàng)時(shí),也會(huì)象用鼠標(biāo)點(diǎn)擊按鈕一樣產(chǎn)生動(dòng)作事件,變化事件。對(duì) start(啟動(dòng))也只給出空監(jiān)聽(tīng)器,可以以后在實(shí)現(xiàn)起功能。為了實(shí)現(xiàn)此界面功能,就用到 JAVA中線程方面的接口,如 Runnable 接口,主要是對(duì) run 方法的運(yùn)用: public void run() { try{while(!interrupted()) {sleep(interval)。對(duì)于重畫(huà)工作,是通過(guò)調(diào)用 paint()方法實(shí)現(xiàn),即用鐘面的顏色覆蓋掉原表針顏色。 else if((/))arg/=n。 12 五 結(jié)束語(yǔ) 通過(guò)本次設(shè)計(jì),成功實(shí)現(xiàn)了基于 JAVA 的圖形用戶(hù)界面。 本文由于時(shí)間關(guān)系,圖形界面比較簡(jiǎn)單,只是 說(shuō)明了 JAVA 中圖形用戶(hù)界面的基本實(shí)現(xiàn)過(guò)程以及相關(guān)技術(shù),各種功能并不完全。 import .*。 private JMenuItem search。 private JMenuItem start。 setTitle(windows2020)。 JMenuBar mbar=new JMenuBar()。 start=new JMenuItem(start)。 establish=new JMenuItem(establish)。 14 JMenuItem[] jm1={textfile,establish,search,help,carryout}。} }。 (timeListener)。 ActionListener staListener=new ActionListener() {public void actionPerformed(ActionEvent e) {。 (start)。} }。 ActionListener seaListener=new ActionListener() {public void actionPerformed(ActionEvent e) {。 。} 15 }。i++) { jm1[i].addActionListener(jm2[1])。} public void menuDeselected(MenuEvent e){int j=0。 } } import .*。 //import 。 ()。 setLocation(frameX,frameY)。 Container c=getContentPane()。 addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) {(0)。 class CalculatorJPanel extends JPanel implements ActionListener{ private JTextField display。 public CalculatorJPanel() {int rows=4,cols=4。 add(display,North)。 for(int i=0。 } private void addButton(Container c,String s) {JButton b=new JButton(s)。 if(39。(0)=39。 17 start=false。} else{ double x=(())。} } } public void calculate(double n) {if((+))arg+=n。 else if((=))arg=n。 setSize(width,height)。 (new CalculatorJPanel())。 import .*。 private String op==。 display=new JTextField(0)。 (new GridLayout(rows,cols))。i++) addButton(p,(i,i+1))。 (this)。=(0)amp。||(.)) {if(start)(s)。 start=false。 op=s。 else if((*))arg*=n。))arg=n。 setSize(width,height)。 (new CalculatorJPanel())。 import .*。 public Timeclock() {super()。 } public Timeclock(String str) {super()。 city=new String(str)。 xcenter=getWidth()/2。 h=()。 ym=(int)((m*)*40+ycenter)。 y=ycenterCLOCK_RADIUS。 (new Color(224,255,245))。ithickness。i+=5) if(i!=15amp。i!=45amp。 ()。 (12,xcenter5,ycenter37)。 if(xm!=lastxm||ym!=lastym){ (xcenter,ycenter1,lastxm,lastym)。} ()。 (xcenter+1,ycenter,xm,ym)。lastys=ys。lastyh=yh。 int xStr=6+((city))/2。 calendar=new GregorianCalendar((tz))。 Graphics g=getGraphics()。 private int interval。 } public void run() { try{while(!interrupted()) {sleep(interval)。s layout and layout ,a handle of Process. Not only install the method of JAVA system and give outing a specific way of realizesesing process, but also explain the JAVA high class characteristic, such as a handle of the multiline Process, the mechanism of unusually handle. moreover, this text still provided the method of handling of some animationsesed. Keywords: JAVA language, GUI, AWT, Swing, Jmodule
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評(píng)公示相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1