• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTextField.setEditable is not working  RSS feed

 
sri rallapalli
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I was trying to set a value to the text box and then i want to make it uneditable, so i am trying to do the following steps,
String value = "Dynamic";
JTextField jtxt = new JTextField();
jtxt.setText(value);
jtxt.setEditable(false);
But it is not working, still i am able to change the value in the text field.
Please let me know what to do to make it disable.
Regards,
Sri.
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why not use a JLabel instead?
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this works for me:
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by miguel lisboa:
this works for me:


We've posted the same in the sun forums, but no response from sri rallapalli as yet. I can only assume that his logic is breaking somewhere else in his code.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!