Skip to content
Advertisement

My problem is when I press the clear button, it just clears the textfield and not data of the previous numbers pressed

The task here is to make a Java program that is like a pincode process. I just have a problem with the process of clearing since when I press the clear button, it actually clears the textfield but when I press new numbers, the numbers I typed before even after pressing clear still shows up

JavaScript

Please help me with my code. Thank you so much!

Advertisement

Answer

You simply forgot to update the JLabel text for displayExtra. Just add displayExtra.setText(textThereExtra); in the else block where you ask if flag != 1 and you should be good to go!

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement