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

正文內(nèi)容

java語言程序設(shè)計_第九章課后習(xí)題答案_鄭莉-文庫吧資料

2025-01-20 21:38本頁面
  

【正文】 JPanel jPanel。import 。import 。import 。import 。import 。import 。使用BorderLayout將JFrame布局分為左右兩塊;左邊又使用GridLayout,包含三個按鈕,右邊在JLabel里顯示一幅圖畫,按鈕控制JLabel是否顯示滾動條。 } } public static void main(String[] args) { new GuessNumber().init()。 } } //按鈕觸發(fā)選擇 public void actionPerformed(ActionEvent e) { if (() == 確定) { ()。 } } } catch (NumberFormatException e) { (this, 請輸入整數(shù), 輸入錯誤, )。)。 ()。 ()。//獲得用戶輸入數(shù) if (numberOfUser 1 || numberOfUser 100) { (this, 請輸入1到100之間的整數(shù))。 (numberOfRandom)。 (buttonOfExit)。 (label3)。 (jTextField)。 jTextField = new JTextField(輸入)。 buttonOfExit = new JButton(退出)。 ().setDefaultButton(buttonOfSure)。 label3 = new JLabel(猜猜看)。 // 各組件的定義 label1 = new JLabel(請輸入一個1到100之間的整數(shù):)。 // 隨機(jī)數(shù) Random random = new Random()。 (new GridLayout(3, 2))。 (400, 120)。// 退出按鈕 JTextField jTextField。// 標(biāo)簽3:提示的內(nèi)容(偏大、偏小、正確) JButton buttonOfSure。// 標(biāo)簽1:“輸入一個1到100之間的整數(shù)” JLabel label2。// 游戲程序隨機(jī)數(shù) int numberOfUser。import 。import 。import 。import 。import 。 }}運行結(jié)果:“猜數(shù)”程序:該程序隨機(jī)在1到100的范圍內(nèi)選擇一個供用戶猜測的整數(shù),然后改程序顯示提示信息,要求用戶輸入一個1到100之間的整數(shù),根據(jù)輸入偏大、偏小、正確,程序?qū)@示不同的圖標(biāo)。 (x: + () + \ny: + ())。 =()。 } public void paint(Graphics g){ (x, y, radius, radius)。 (this)。 (false)。 public MyJFrame(){ (繪制圓形)。 int y=50。import 。import 。,當(dāng)鼠標(biāo)在繪制區(qū)域中單擊時,該正方形的左上角頂點應(yīng)準(zhǔn)確的跟隨鼠標(biāo)光標(biāo)移動,重繪該圓形。 } } //點擊“退出”按鈕jButton2觸發(fā)的方法 public void jButton2ActionPerformed(ActionEvent evt) { (0)。//標(biāo)簽內(nèi)容為面積 } catch (NumberFormatException r) { //單文本為非數(shù)字彈出提示“輸入錯誤”框 (this, 請輸入數(shù)字類型, 輸入錯誤,)。//字符轉(zhuǎn)化為雙精度 (Round(a))。 } //點擊“計算”按鈕jButton1觸發(fā)的方法 private void jButton1ActionPerformed(ActionEvent evt) { //捕獲單文本輸入非數(shù)字的異常 try { String s = ()。 String s = new String((area))。 return s。 } // 求周長方法 private String Round(double a) { double perimeter = a * 2 * 。 (jButton1)。 (jLabel4)。 (jLabel2)。 //將8個組件加入到內(nèi)容面板 (jLabel1)。 //聲明定義內(nèi)容面板,并且設(shè)置其布局格式為:4行2列格子 Container c = getContentPane()。 //按鈕添加監(jiān)聽器 (new ActionListener() { public void actionPerformed(ActionEvent evt) { jButton2ActionPerformed(evt)。 //按鈕添加監(jiān)聽器 (new ActionListener() { public void actionPerformed(ActionEvent evt) { jButton1ActionPerformed(evt)。 jButton1 = new JButton(計算)。 jLabel5 = new JLabel(, )。 jLabel3 = new JLabel(, )。 } } private void initComponents() { //聲明8個組件
點擊復(fù)制文檔內(nèi)容
試題試卷相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1