Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

grey out Jtextfield when disabled.  RSS feed

 
Fabio Piergentili
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know how to grey out Jtextfield when disabled? After disabling it the user cannot type into it but their is no visual indication that it is disabled.

Thanks
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps it's L&F-dependent, but when I run this class, the disabled jtextfield is grayed-out.

 
Fabio Piergentili
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you. That worked. I was using .enabled() instead of setEnabled().

 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fabio Piergentili wrote:Thank you. That worked. I was using .enabled() instead of setEnabled().


You're quite welcome. This is why it's always a good idea to if possible post a small compilable program that demonstrates your problem. That way we won't have to guess what's wrong. Much luck and Keep on Codin'...
 
mark goking
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should have checked closely what .enabled() does. it returns a boolean, it doesnt do anything ;)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!