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

正文內(nèi)容

java程序設(shè)計(jì)實(shí)驗(yàn)指導(dǎo)手冊-資料下載頁

2025-06-25 07:00本頁面
  

【正文】 er{ private JTextField text_decimal,text_binary,text_octal,text_hex。 private JDialog dialog。 private JLabel label_dialog。 public BinaryJFrame() { super(十進(jìn)制整數(shù)轉(zhuǎn)換)。 (200,140)。 (false)。 //窗口大小不能改變 ()。 (300,240)。 (EXIT_ON_CLOSE)。 //單擊窗口關(guān)閉按鈕時(shí),結(jié)束程序運(yùn)行 (new ())。 //流布局且左對齊 (new JLabel( 十進(jìn)制))。 text_decimal = new JTextField(1023,10)。 (text_decimal)。 (this)。 //注冊單擊事件監(jiān)聽器 (new JLabel( 二進(jìn)制))。 text_binary = new JTextField(10)。 (false)。 //只能顯示,不允許編輯 (text_binary)。 (new JLabel( 八進(jìn)制))。 text_octal = new JTextField(10)。 (false)。 (text_octal)。 (new JLabel( 十六進(jìn)制))。 text_hex = new JTextField(10)。 (false)。 (text_hex)。 ()。 (true)。 dialog = new JDialog(this,提示,true)。 //模式窗口 (240,80)。 label_dialog = new JLabel(,)。 //標(biāo)簽的字符串為空,居中對齊 (label_dialog)。 (HIDE_ON_CLOSE)。 //單擊對話框的關(guān)閉按鈕時(shí),隱藏對話框而不結(jié)束程序運(yùn)行 } public void display() { try { int i = (())。 ((i))。 //二進(jìn)制 ((i))。 //八進(jìn)制 ((i))。 //十六進(jìn)制 } catch(NumberFormatException nfe) { (\+()+\ 不能轉(zhuǎn)換成整數(shù),請重新輸入!)。 (()+100,()+100)。 (true)。 } finally{} } public void actionPerformed(ActionEvent e) //文本行中單擊回車鍵 { ()。 } public static void main(String arg[]) { new BinaryJFrame()。 }}5畫月亮利用兩個(gè)重疊的圓畫出月亮的效果,如教材篇213所示,要求月亮大小能夠隨著窗口的大小而變化import 。import 。import 。import 。import 。import 。/*import .*。import .*。import .*。*/public class MoonJFrame extends JFrame implements ComponentListener{ public MoonJFrame() { super(Moon)。 (400,300)。 (true)。 (EXIT_ON_CLOSE)。 } public void paint(Graphics g) //在JFrame上作圖 { int x=0,y=0。 //圓外切矩形左上角坐標(biāo) x = () /4。 y = () /4。 int diameter = (()/2, ()/2)。 //圓的直徑 ()。 (x,y,diameter,diameter)。 //畫圓 (())。 //設(shè)置為窗口背景色 (x20,y20,diameter,diameter)。 //畫圓 } public void ponentResized(ComponentEvent e) //改變窗口大小時(shí) { repaint()。 //重畫 } public void ponentMoved(ComponentEvent e) { } public void ponentHidden(ComponentEvent e) { } public void ponentShown(ComponentEvent e) { } public static void main(String arg[]) { new MoonJFrame()。 }} 實(shí)驗(yàn) 5 多線程基礎(chǔ)編程實(shí)驗(yàn)?zāi)康?,?chuàng)建線程類對象,啟動線程,并觀察運(yùn)行、停止。創(chuàng)建實(shí)現(xiàn)了Runnable接口的線程類對象以后,啟動線程,通過觀察運(yùn)行和停止,掌握對線程執(zhí)行過程中的異常的處理方法。實(shí)驗(yàn)要求 。 實(shí)驗(yàn)內(nèi)容1. ;2. ;3. 啟動線程,并觀察運(yùn)行、停止。Exercise 1:Write a program that displays the name of the thread that executes main.Exercise 2:? Creat two threads, one thread print ”A” and the other print “B” alternately. . ABBABAABBA….etc.Exercise 3:? 隨便選擇兩個(gè)城市作為預(yù)選旅游目標(biāo)。實(shí)現(xiàn)兩個(gè)獨(dú)立的線程分別顯示10次城市名,每次顯示后休眠一段隨機(jī)時(shí)間(1000毫秒以內(nèi)),哪個(gè)城市先顯示完畢,就決定去哪個(gè)城市。分別用Runnable 接口和Thread類實(shí)現(xiàn)。4.運(yùn)行下面的程序,理解用創(chuàng)建Thread子類的方法實(shí)現(xiàn)多線程。class SimpleThread extends Thread { public SimpleThread(String str) { super(str)。 } public void run() { for (int i = 0。 i 10。 i++) { (i + + getName())。 try { sleep((int)(() * 1000))。 } catch (InterruptedException e) {} } (DONE! + getName())。 }}public class TwoThreadsTest { public static void main (String[] args) { new SimpleThread(Go to Beijing??).start()。 new SimpleThread(Stay here!!).start()。 }}5.運(yùn)行下面的程序,理解用實(shí)現(xiàn)Runnable接口的方法實(shí)現(xiàn)多線程。//這是一個(gè)時(shí)鐘Applet,它顯示當(dāng)前時(shí)間并逐秒進(jìn)行更新。import .*。import .*。import .*。public class Clock extends Applet implements Runnable{ Thread clockThread。 public void start(){ if(clockThread==null){ clockThread=new Thread(this,Clock)。 ()。 } } public void run(){ while(clockThread !=null){ repaint()。 try{ (1000)。 }catch(InterruptedException e){} } } public void paint(Graphics g){ Date now=new Date()。 (()+。+()+。+(),5,10)。 } public void stop(){ ()。 clockThread=null。 }}
點(diǎn)擊復(fù)制文檔內(nèi)容
范文總結(jié)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1