Hello people,

i'm making virtual keyboard and i stucked at smth silly but dunno how to solve it

Code:
JButton btnC = new JButton("C");
		btnC.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				text = String.format(" %s", "c");
 
				Text_t.setText(text);
now i dont understand, when i press C, and after it i press N for example , it deletes C and writes N, what i need to add here to make it write normally.
Or maybe there is some other way than mine to do it , so if u can write an example. I'm beginner in this.

Thank you