Reputation: 39
Problem: I am trying to make my JTextField uneditable in both of these panels. In the east panel. And also I have a button that says Roll the dice since it is a board game im trying to make, and it generates random numbers from 0 to 6. But when i get the number i can still edit the text. For the user name it is still editable after i ask the user through JOptionPane in the beginning of the program to enter their username before they play the game, then i did a setText method so it sets their name in the box. While the program is still running, i can still edit their name..
Upvotes: 3
Views: 9663
Reputation: 35096
If you call throwField2.setEditable(false)
, the user will no longer be able to edit the TextField
Upvotes: 0