使用したいのですが、プログラムにボタンNumberFormatException
があるため、コードにエラーがあります。TextField
テキストフィールドに数値を入力すれば問題ありません。文字を入力するとエラーメッセージを出したいのですが、使いません。私を助けてください?
私のコード
private JTextField t1=new JTextField(10);
private JButton o88 = new JButton("send");
try{
o88.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
int a = 0;
a = Integer.parseInt(t1.getText());
}
});
}
catch (NumberFormatException e){
System.out.println( e.getMessage());
}