亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

是否可以基于 if 語句進行循環?

是否可以基于 if 語句進行循環?

智慧大石 2021-09-03 14:39:45
如果用戶在輸入輸入后單擊“否”,我將嘗試讓我的代碼循環。import java.awt.event.WindowAdapter;import javax.swing.JFrame;import javax.swing.JOptionPane;    public class Sizer extends WindowAdapter     {            public static void main (String[]args){            JFrame m = new JFrame();            JOptionPane.showMessageDialog(m,"Ok To set the window size you are going to type in the number for each value REMEMBER THE SIZE IS IN PIXELS");            String input1= JOptionPane.showInputDialog("Height (suggested under 1080 and above 300)");            int Height= Integer.parseInt( input1);在此輸入之后,我必須確認該用戶是否正確輸入了它,如果他們單擊“是”,它會繼續運行,如果他們單擊“否”,它會退出我希望它讓用戶再次輸入它,我該怎么做?        int a1 = JOptionPane.showConfirmDialog(m,"Are you sure that this is the correct Height"+ Height);        if (a1==JOptionPane.YES_OPTION){        if (a1==JOptionPane.NO_OPTION){        }        String input2= JOptionPane.showInputDialog("Width (suggested under 1920 and above 300)");        int Width = Integer.parseInt( input2);        JFrame frame = new JFrame();                            Slop comp = new Slop();        frame.add(comp);        frame.setSize(Height,Width);        frame.setTitle("Slop of a Line");        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);        frame.setVisible(true);                }           }}           
查看完整描述

2 回答

  • 2 回答
  • 0 關注
  • 188 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號