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

正文內(nèi)容

java2實(shí)用教程課后習(xí)題參考答案(第三版)-資料下載頁(yè)

2025-06-20 04:00本頁(yè)面
  

【正文】 。buttonForeColor=new Button(前景色)。 setLayout(new FlowLayout())。 add(button)。add(textfield)。 add(textarea)。 add(panel)。 add(box)。 add(choice)。 add(list)。 add(label)。 add(can)。add(buttonBackColor)。add(buttonForeColor)。addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){(0)。}})。(this)。(this)。 setBounds(100,100,300,300)。 setVisible(true)。validate()。}public void actionPerformed(ActionEvent e){if(()==buttonBackColor){()。 ()。 ()。 ()。 ()。 ()。 ()。 ()。 ()。}else if(()==buttonForeColor){()。 ()。 ()。 ()。 ()。 ()。 ()。 ()。 ()。}}}class Mycanvas extends Canvas{Mycanvas(){ }public void paint(Graphics g){(我是畫(huà)布,5,5)。}}class Mypanel extends Panel{Button button1。Mypanel(){button1=new Button(我是面板)。add(button1)。}}public class Test{public static void main(String args[]){ new WindowColor()。}},有一個(gè)標(biāo)題 為“移動(dòng)”的窗口,窗口的布局 為 null ,在窗口中有兩個(gè)按鈕,單 擊一個(gè) 按鈕讓另一個(gè)按鈕移動(dòng) 。答: import .*。import .*。class WindowMove extends Frame implements ActionListener{Button button1,button2。 WindowMove(String s){super(s)。setLayout(null)。button1=new Button(我讓它橫向走動(dòng))。 button2=new Button(我讓它縱向走動(dòng))。 ()。 ()。 (this)。 (this)。(())。 (())。 add(button1)。add(button2)。addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){(0)。}})。(20,80,100,30)。(100,180,100,30)。setBounds(100,100,500,500)。setVisible(true)。validate()。}public void actionPerformed(ActionEvent e){Rectangle rect1=()。int x1=(int)()。int y1=(int)()。Rectangle rect2=()。int x2=(int)()。 int y2=(int)()。 if(()==button1){x2=x2+5。(x2,y2)。}else if(()==button2){y1=y1+5。(x1,y1)。}}}public class Test{public static void main(String args[]){new WindowMove(移動(dòng))。}},有一個(gè)標(biāo)題 為“改變顏色”的窗口,窗口的布局 為 null,在窗口中 有 3 個(gè)按鈕和一個(gè) 畫(huà)布,3 個(gè)按鈕的顏色分別是紅、 綠、藍(lán)。單擊相應(yīng)的按鈕,畫(huà)布繪制相應(yīng)顏色的 圓。答: import .*。import .*。class WindowChangeColor extends Frame implements ActionListener{Button buttonRed,buttonGreen,buttonBlue。 Mycanvas canvas。WindowChangeColor(String s){super(s)。setLayout(null)。buttonRed=new Button(紅色)。buttonGreen=new Button(綠色)。buttonBlue=new Button(藍(lán)色)。 canvas=new Mycanvas()。 ()。 ()。 ()。 add(canvas)。 (10,10,150,150)。 add(buttonRed)。 (10,170,50,30)。 add(buttonGreen)。 (70,170,50,30)。 add(buttonBlue)。 (130,170,50,30)。 (this)。 (this)。 (this)。 addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){(0)。}})。setBounds(100,100,200,250)。 setVisible(true)。 validate()。}public void actionPerformed(ActionEvent e){if(()==buttonRed){(1)。()。}else if(()==buttonGreen){(2)。()。}else if(()==buttonBlue){(3)。()。}}}class Mycanvas extends Canvas{int x=0。 Mycanvas(){setBackground()。}public void setX(int y){x=y。}public void paint(Graphics g){switch(x){case 1: ()。 break。case 2: ()。 break。case 3: ()。 break。default:()。}(65,65,50,50)。}}public class Test{public static void main(String args[]){new WindowChangeColor(改變顏色)。}},測(cè) 試 Curso r 類(lèi)中表示鼠標(biāo)形狀的靜態(tài) 常量。 答: import .*。import .*。class WindowCursor extends Frame implements ActionListener{Button button,button1。 TextField text。int n=1。 WindowCursor(){button=new Button(單擊我)。text=new TextField(將鼠標(biāo)放在上面的按鈕上看形狀)。 button1=new Button(看看你鼠標(biāo)的形狀)。 add(button,)。 add(button1,)。 add(text,)。()。()。 (this)。 addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){(0)。}})。setBounds(100,100,190,150)。 setVisible(true)。 validate()。}public void actionPerformed(ActionEvent e){n=(n+1)%10。switch(n){case0: (())。 break。case1: (())。 break。case2: (())。 break。case3: (())。 break。case 4:(())。break。 case5: (())。 break。case 6:(())。break。 case7: (())。 break。case 8:(())。break。 case9: (())。 break。}}}public class Test{public static void main(String args[]){new WindowCursor()。}} 子 ,當(dāng)釋放鼠標(biāo)鍵時(shí),如果當(dāng) 前組件和其他組件相交,就將其他組件設(shè)置為不 可見(jiàn)狀 態(tài)。答: import .*。import .*。import 。class Win extends Frame implements MouseListener,MouseMotionListener{Button button。 TextField text。 int x,y。boolean move=false。 Win(){button=new Button(用鼠標(biāo)拖動(dòng)我)。 text=new TextField(用鼠標(biāo)拖動(dòng)我,8)。 ()。()。(this)。 (this)。 (this)。 (this)。 addMouseMotionListener(this)。 setLayout(new FlowLayout())。 add(button)。add(text)。addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){(0)。}})。setBounds(10,10,350,300)。 setVisible(true)。 validate()。}public void mousePressed(MouseEvent e){}public void mouseReleased(MouseEvent e){move=false。Rectangle rect=()。int x=(int)()。 int y=(int)()。 if((())){if(()==button){(false)。}else if(()==text){(false)。}}}public void mouseEntered(MouseEvent e){} public void mouseExited(MouseEvent e){} public void mouseClicked(MouseEvent e){} public void mouseMoved(MouseEvent e){}public void mouseDragged(MouseEvent e){Component =null。if(() instanceof Component){=(Component)()。if(!=this) move=true。 e=(,e,this)。 if(move){x=()。y=()。int w=().width , h=().heig ht。 (xw/2,yh/2)。}}}}public class Test{public static void main(String args[]){Win win=new Win()。}} 子 ,要求一個(gè)按鈕在移動(dòng)時(shí) ,不允許和其他按鈕相交。 答: import .*。import .*。class Win extends Frame implements KeyListener{Button b[]=new Button[8]。int x,y。 Win(){setLayout(new FlowLayout())。for(int i=0。i8。i++){b[i]=new Button(+i)。 b[i].addKeyListener(this)。 add(b[i])。}addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){(0)。}})。setBounds(10,10,300,300)。 setVisible(true)。 validate()。}public void keyPressed(KeyEvent e){boolean move=false。Button button=(Button)()。 Rectangle buttonrect=()。 String str=()。int xx=(str)。
點(diǎn)擊復(fù)制文檔內(nèi)容
語(yǔ)文相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1