I am making a calculator to test my skills in java. How can make the numbers to show up in the jTextfield until i pressed one button to calculate the numbers; i want every numbers to show up in the textfield. for example if i pressed 1 and zero i want the textfield to have 10.
int num;
JTextField in = new JTextField(20); // input field where numbers will up;
public void actionPerformed(ActionEvent e) {
if (e.getSource() == bouttons.get(0)) {
num = 0;
in.setText("" + num);
}
if (e.getSource() == bouttons.get(1)) {
int num = 1;
in.setText("" + num);
}
}