ActionListener,ItemListener { 串 TSN </跨度> ; JFileChooser拨号; JPanel welcome,newt; JButton sbttn,nbttn,ebttn,nqb,nab,dqb,dab,sav,ext; @SuppressWarnings(“rawtypes (questions.getSelectedIndex())); questions.removeItemAt(questions.getSelectedIndex()); REF(); } } if(src == sav){ TSN </跨度> = JOptionPane.showInputDialog(这个
boolean err = true; while(err) { try { points = Integer.valueOf(txt2); err = false; } catch (NumberFormatException e) { txt2 = JOptionPane.showInputDialog(this, "Enter the amount of points for the Answer:", "Points..."); if (txt2.equals("Points...")) return; } }
我正在调查这个。如果text2不是数字,它将抛出异常,并且不会设置 err 为假。假设text2不等于“Points ......”,这可能导致循环无限循环。
err