第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

GridLayout JButton JOptionPane 與每個(gè)按鈕的

GridLayout JButton JOptionPane 與每個(gè)按鈕的

肥皂起泡泡 2021-10-28 16:57:04
我正在制作一款日本約會(huì)游戲風(fēng)格的約會(huì)游戲,其中包含圖片和回復(fù),以供娛樂(lè)和練習(xí)。我正在嘗試為JOptionPane網(wǎng)格布局中的每個(gè)按鈕顯示一個(gè)消息對(duì)話框,作為對(duì)每個(gè)選項(xiàng)的響應(yīng)。這樣它就像一棵邏輯樹。我不習(xí)慣使用動(dòng)作監(jiān)聽器,因?yàn)槲矣悬c(diǎn)初學(xué)者。這是我的代碼。我只是不習(xí)慣這樣做的語(yǔ)法。誰(shuí)能幫我?import java.awt.BorderLayout;import java.awt.Dimension;import java.awt.Font;import java.awt.GridLayout;import java.util.Scanner;import javax.swing.JFrame;import javax.swing.ImageIcon;import javax.swing.JLabel;import javax.swing.*;//Implementations of packagespublic class NestedPanels extends JPanel {   private static final String[] BTN_TEXTS = { "Say Hello", "Say You Look Good", "Say Sorry I'm Late" }; //three buttons   private static final int TITLE_POINTS = 3; //number of objects in text box   public NestedPanels() { //implemeted class      JPanel southBtnPanel = new JPanel(new GridLayout(3, 2, 1, 1)); //grid layout of buttons and declaration of panel SoutbtnPanel      for (String btnText : BTN_TEXTS) { //BTN TEXT button titles linked to string btnText label         southBtnPanel.add(new JButton(btnText)); //add btnText label      }      setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); //layout of buttons "Button text"      setLayout(new BorderLayout());      add(Box.createRigidArea(new Dimension(600, 600))); //space size of text box webapp over all      add(southBtnPanel, BorderLayout.SOUTH);   }   private static void createAndShowGui() {//class to show gui        NestedPanels mainPanel = new NestedPanels(); //mainPanel new class of buttons instantiation        JFrame frame = new JFrame("Date Sim 1.0");//title of webapp on top        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);        frame.getContentPane().add(mainPanel);        frame.pack();        frame.setVisible(true);        ImageIcon icon = new ImageIcon("C:/Users/wchri/Pictures/10346538_10203007241845278_2763831867139494749_n.jpg");        JLabel label = new JLabel(icon);        mainPanel.add(label);        frame.setDefaultCloseOperation        (JFrame.EXIT_ON_CLOSE);        frame.pack();        frame.setVisible(true);   }
查看完整描述

目前暫無(wú)任何回答

  • 0 回答
  • 0 關(guān)注
  • 133 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)