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

正文內(nèi)容

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

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

【正文】 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è)畫布,3 個(gè)按鈕的顏色分別是紅、綠、藍(lán)。單擊相應(yīng)的按鈕,畫布繪制相應(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 類中表示鼠標(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){case 0:(())。break。case 1:(())。break。case 2:(())。break。case 3:(())。break。case 4:(())。break。case 5:(())。break。case 6:(())。break。case 7:(())。break。case 8:(())。break。case 9:(())。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)。x=().x。y=().y。if(()==){y=y2。if(y=0) y=0。}else if(()==){y=y+2。if(y=300) y=300。}else if(()==){x=x2。if(x=0) x=0。}else if(()==){x=x+2。if(x=300) x=300。}(x,y)。for(int k=0。k8。k++){Rectangle rect=b[k].getBounds()。if(((rect))amp。amp。(xx!=k)){move=true。}}if(move==false){(x,y)。}}public void keyTyped(KeyEvent e){}public void keyReleased(KeyEvent e){}}public class Test{public static void main(String args[]){Win win=new Win()。}}第8 章建立對(duì)話框1. 編寫一個(gè)應(yīng)用程序,用戶可以在一個(gè)文本框里輸入數(shù)字字符,按Ente r 鍵后將數(shù)字放入一個(gè)文本區(qū)。當(dāng)輸入的數(shù)字大于100 0 時(shí),彈出一個(gè)有模式的對(duì)話框,提示用戶數(shù)字已經(jīng)大于1000,是否繼續(xù)將該數(shù)字放入文本區(qū)。答: import .*。import .*。import 。class WindowSaveNumber extends Frame implements ActionListener{TextField textInputNumber。TextArea textSaveNumber。WindowSaveNumber(){textInputNumber=new TextField(15)。textSaveNumber=new TextArea()。add(textInputNumber,)。add(textSaveNumber,)。(this)。setBounds(100,100,400,300)。setVisible(true)。val
點(diǎn)擊復(fù)制文檔內(nèi)容
職業(yè)教育相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1