joptionpane

    -2熱度

    1回答

    我在弄清楚如何爲選項窗格中使用的選項指定名稱/標題,以便我可以在if語句中使用它們。這裏是我到目前爲止的代碼: int i = 0; while(i<1){ JFrame frame = new JFrame(); String[] options = new String[2]; options[0] = new String("Peat");

    0熱度

    1回答

    中指定的OptionPaneUI我想用我自己的OptionPaneUI重寫BasicOptionPaneUI。但是,我創建的JOptionPanes仍然被BasicOptionPaneUI繪製。 這裏是initClassDefaults法在我的自定義外觀和感覺: @Override protected void initClassDefaults(UIDefaults table) {

    0熱度

    1回答

    在我的應用程序中,需要在用戶提供輸入時經常顯示JOptionPane.showOptionDialog。 有時它不會顯示,並等待用戶輸入並掛起。 在這裏我附上了示例代碼來重現相同。 import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridBagLayout; import javax.swin

    0熱度

    1回答

    我想從我的主類調用我的JOptionPane 的方法。 有沒有具體的方法來做到這一點? Dictionary word1 = new Dictionary(null); CardCatalog catalog = new CardCatalog(); final ImageIcon welcome = new ImageIcon("welcome.jpg"); JOptionPane.sh

    0熱度

    2回答

    我遇到了一段代碼的問題。當我在我的GUI中點擊它時,一旦我輸入了文本,它就會重新打開。任何人都可以向我解釋代碼有什麼問題。我使用這在JLabel在我的GUI設置一個名稱 setNameButton.addActionListener((ActionEvent e) -> { String usernameinput; String defaultUsername = "dom

    2熱度

    1回答

    有沒有辦法改變JOptionPane.showMessageDialog字體?我試圖編寫消息對話框的代碼,如果可能的話我需要更改字體。

    0熱度

    3回答

    我有這樣的代碼: int rev=0; int opt=Integer.parseInt(JOptionPane.showInputDialog("How many numbers do you need?")); for (int i=0; i<numbers; i++) { int numbers=Integer.parseInt(JOptionPane.showInputDia

    -1熱度

    1回答

    我正在研究一個簡單的Java應用程序。我有拋出異常的問題。 實際上,應該在線程中拋出異常。所以有這些例外的線程: public void setVyplata(Otec otec) { try { otec.setVyplata(Integer.parseInt(textField1.getText())); } catch (NumberFormatExcep

    -3熱度

    3回答

    如何區分正數和負數?我有這樣的代碼: import java.util.ArrayList; import java.swing.JOptionPane; public class Test { public static void main(String[] args) { ArrayList al = new ArrayList(); int num=

    0熱度

    2回答

    如何刪除重複的號碼並要求用戶添加新號碼以替換重複的號碼?比方說,用戶要求5號碼:使用我做的代碼6, 7, 8, 7, 9,輸出Number 7 was duplicated in position 3 現在我需要,是要求用戶添加一個新的號碼,以取代7這樣就不會有幫助任何重複。 所以我希望整個輸出爲Your numbers without duplicates:,它會打印輸入的數字而不會有任何重複。