我应该在哪里放置增量?

时间:2016-11-25 11:28:23

标签: java swing user-interface

我很难弄清楚应该放置ers++ers+=1的位置。我已经尝试过for循环和do-while,它工作并达到了3的限制,但它也应该让用户再次输入并再次检查输入。

if (ers < 3) {
    if (a.equals(SignupPage.ee) && b.equals(SignupPage.dd) && !(a.isEmpty()) && !(b.isEmpty())) {
        System.out.println(a+"  "+b);
        tf = true;
        JOptionPane.showMessageDialog(null, "Welcome!", "Payment Portal", JOptionPane.INFORMATION_MESSAGE);
        ElectricityPage ep = new ElectricityPage();
        ep.setVisible(true);
    } else if (a.equals("Admin") && b.equals("javaness") && !(a.isEmpty()) && !(b.isEmpty())) {
        SignupPage.aa = Admin.Fname[0];
        SignupPage.aa = Admin.Lname[0];
        ers+=1;

        ElectricityPage ep = new ElectricityPage();
        ep.setVisible(true);
    } else {
        JOptionPane.showMessageDialog(null, "something is wrong", "Payment Portal", JOptionPane.ERROR_MESSAGE);
        //ers=ers+1;   
    }
    System.out.println(ers);
}

0 个答案:

没有答案