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

正文內(nèi)容

[工學(xué)]java龔永罡---答案-資料下載頁

2025-01-14 08:42本頁面
  

【正文】 { String item= 【代碼6】 // choice返回被選中的條目 int w=().width。 int h=().height。 int m=(w,h)。 (m/6)。 if((itemRed)) { if(signal!=null) { (1)。 (0)。 (0)。 (w/3,0)。 ()。 } } else if((itemYellow)) { if(signal!=null) { (0)。 (1)。 (0)。 (w/3,h/3)。 ()。 } } else if((itemGreen)) { if(signal!=null) { (0)。 (0)。 (1)。 (w/3,2*h/3)。 ()。 } } }}public class SignalMainClass{ public static void main(String args[]) { SignalFrame frame。 frame=new SignalFrame() 。 (信號燈)。 }}178。 實驗后的練習(xí):1. 改進(jìn)上述程序,在下拉列表中增加“熄滅所有燈”選項,當(dāng)選中該項時,畫布上繪制一個半徑為0,位置是(0,0)的圓。3.布局與日歷。178。 實驗要求:編寫一個應(yīng)用程序,有一個窗口,該窗口為BorderLayout布局。窗口的中心添加一個Panel容器:pCenter,pCenter的布局是7行7列的GriderLayout布局,pCenter中放置49個標(biāo)簽,用來顯示日歷。窗口的北面添加一個Panel容器pNorth,其布局是FlowLayout布局,pNorth放置兩個按鈕:nextMonth和previousMonth,單擊nextMonth按鈕,可以顯示當(dāng)前月的下一月的日歷;單擊previousMonth按鈕,可以顯示當(dāng)前月的上一月的日歷。窗口的南面添加一個Panel容器pSouth,其布局是FlowLayout布局,pSouth中放置一個標(biāo)簽用來顯示一些信息。178。 程序運行效果示例: 程序運行效果如下圖所示: 178。 程序模板:import 。public class CalendarBean { String day[]。 int year=2005,month=0。 public void setYear(int year) { =year。 } public int getYear() { return year。 } public void setMonth(int month) { =month。 } public int getMonth() { return month。 } public String[] getCalendar() { String a[]=new String[42]。 Calendar 日歷=()。 (year,month1,1)。 int 星期幾=()1。 int day=0。 if(month==1||month==3||month==5||month==7||month==8||month==10||month==12) { day=31。 } if(month==4||month==6||month==9||month==11) { day=30。 } if(month==2) { if(((year%4==0)amp。amp。(year%100!=0))||(year%400==0)) { day=29。 } else { day=28。 } } for(int i=星期幾,n=1。i星期幾+day。i++) { a[i]=(n) 。 n++。 } return a。 } }import .*。import .*。import .*。import .*。public class CalendarFrame extends Frame implements ActionListener{ Label labelDay[]=new Label[42]。 Button titleName[]=new Button[7]。 String name[]={日,一,二,三, 四,五,六}。 Button nextMonth,previousMonth。 int year=2006,month=10。 CalendarBean calendar。 Label showMessage=new Label(,)。 public CalendarFrame() { Panel pCenter=new Panel()。 【代碼1】 //將pCenter的布局設(shè)置為7行7列的GridLayout 布局。 for(int i=0。i7。i++) { titleName[i]=new Button(name[i])。 【代碼2】//pCenter添加組件titleName[i]。 } for(int i=0。i42。i++) { labelDay[i]=new Label(,)。 【代碼3】//pCenter添加組件labelDay[i]。 } calendar=new CalendarBean()。 (year)。 (month)。 String day[]=()。 for(int i=0。i42。i++) { labelDay[i].setText(day[i])。 } nextMonth=new Button(下月)。 previousMonth=new Button(上月)。 (this)。 (this)。 Panel pNorth=new Panel(), pSouth=new Panel()。 (previousMonth)。 (nextMonth)。 (showMessage)。 (日歷:+()+年+ ()+月 )。 ScrollPane scrollPane=new ScrollPane()。 (pCenter)。 【代碼4】// 窗口添加scrollPane在中心區(qū)域 【代碼5】// 窗口添加pNorth 在北面區(qū)域 【代碼6】// 窗口添加pSouth 在南區(qū)域。 } public void actionPerformed(ActionEvent e) { if(()==nextMonth) { month=month+1。 if(month12) month=1。 (month)。 String day[]=()。 for(int i=0。i42。i++) { labelDay[i].setText(day[i])。 } } else if(()==previousMonth) { month=month1。 if(month1) month=12。 (month)。 String day[]=()。 for(int i=0。i42。i++) { labelDay[i].setText(day[i])。 } } (日歷:+()+年+()+月 )。 }}public class CalendarMainClass{ public static void main(String args[]) { CalendarFrame frame=new CalendarFrame()。 (100,100,360,300)。 (true)。 ()。 (new () { public void windowClosing( e) { (0)。 } } )。 }}178。 實驗后的練習(xí):1. 請在CalendarFrame類中增加一個TextField文本框,用戶可以通過在文本框中輸入年份來修改calendar對象的int成員year?!窘Y(jié)果】將本次上機實驗結(jié)果按照實驗要求內(nèi)容依次進(jìn)行,填寫實驗?zāi)繕?biāo)、過程、結(jié)果。 【注意事項】①實驗報告要求每人提交一份,使用專門的報告紙,內(nèi)容寫全,包括實驗名稱、班級、姓名、同組人,試驗日期、交報告日期等。②報告不需要填寫源代碼,只要將完成情況和所有練習(xí)題結(jié)果寫上就可以。【思考題】實驗六 多線程【目的】 ①掌握使用Thread的子類創(chuàng)建線程;②學(xué)習(xí)使用Thread類創(chuàng)建線程;③學(xué)習(xí)處理線程同步問題?!緝?nèi)容】 1.漢字打字練習(xí)。178。 實驗要求:編寫一個Java應(yīng)用程序,在主線程中再創(chuàng)建一個Frame類型的窗口,在該窗口中再創(chuàng)建1個線程giveWord。線程giveWord每隔2秒鐘給出一個漢字,用戶使用一種漢字輸入法將該漢字輸入到文本框中。178。 程序運行效果示例: 程序運行效果如下圖所示: 178。 程序模板:import .*。public class WordThread extends Thread{ char word。 int k=19968。 Label 。 WordThread(Label ) { =。 } public void run() { k=19968。 while(true) { word=(char)k。 (+word)。 try{ 【代碼1】//調(diào)用sleep方法使得線程中斷6000豪秒 } catch(InterruptedException e){} k++。 if(k=29968) k=19968。 } } }import .*。import .*。public class ThreadFrame extends Frame implements ActionListener{ Label wordLabel。 Button button。 TextField inputText,scoreText。 【代碼2】//用WordThread聲明一個giveWord對象 int score=0。 ThreadFrame() { wordLabel=new Label( ,)。 (new Font(,72))。 button=new Button(開始)。 inputText=new TextField(3)。 scoreText=new Text
點擊復(fù)制文檔內(nèi)容
試題試卷相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1