How do you append to a JTextField with a JButton without the previous text being deleted
for example if i had
JButton num0 = new JButton("0")
JButton num1 = new JButton("1")
JTextField text = new JTextField()
text.setEditable(false)
num0.addActionListener(this)
num1.addActionListener(this)
text.addActionListener(this)
public void actionPerfomed(ActionEvent e){
Object source = e.getSource()
if(source == num0)
text.setText("0")
if(source == num1)
text.setText("1")
}
i would like the textfield to say if 0 then 1 is pressed - 01
but instead it will do 0 then when 1 is pressed 0 is erased and 1 is in the textfield
any help would be appreciated