if a gui have 2 text fields and there are 10 buttons(0-9) to input numbers in text fields then how it will choose that which field get input. this i problem in my gui i write 2 methods but not working my code is below
public void actionPerformed(ActionEvent e){
if(e.getSource()==b1){
if(op1.isValidateRoot())
op1.setText(op1.getText()+"1");
else if(op2.isValidateRoot())
op2.setText(op2.getText()+"1");
}
}
it is not working and op1
and op2
are two JTextField
what will be the solution