Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to disable entire jpanel and all it's contents?  RSS feed

 
Dan Peters
Greenhorn
Posts: 10
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'd like to enable/disable a jpanel and it's entire contents in one fell swoop. I could of course call each component's .setEnabled() method, but I figured there must be a better way!

Any help appreciated!
 
Knute Snortum
Sheriff
Posts: 3546
85
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe you can do a setEnabled(false) on the JPanel and everything will be disabled.
 
K. Tsang
Bartender
Posts: 3624
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:I believe you can do a setEnabled(false) on the JPanel and everything will be disabled.


Not sure about that.

According to javadoc setEnable() method

Sets whether or not this component is enabled. A component that is enabled may respond to user input, while a component that is not enabled cannot respond to user input. Some components may alter their visual representation when they are disabled in order to provide feedback to the user that they cannot take input.

Note: Disabling a component does not disable its children.

Note: Disabling a lightweight component does not prevent it from receiving MouseEvents.
 
Rob Camick
Ranch Hand
Posts: 2752
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out Disabled Panel for a couple of solutions you might be able to use.
 
Dan Peters
Greenhorn
Posts: 10
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy,

I noted that disabling the panel did not disable the children, thus the reason for posting this question.

Thanks everybody for your comments, particularly Rob; it looks like one of the solutions on 'Disabled Panel' will do the trick!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!