File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Solution to Disable a Panel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Solution to Disable a Panel" Watch "Solution to Disable a Panel" New topic

Solution to Disable a Panel

Charith Fernando
Ranch Hand

Joined: Sep 12, 2005
Posts: 67
Hi all,

I have few panels in a JDialog which i need to disable for editing. basically i dont wont to gray-out the components and disable the components, but keeping the components as it is, i wont them to be un-editable, i know that components such as text boxes have that capability, but do other components such as check boxes and radio button have that? and on the other hand the solution which i'm thinking is basically to have a pane on top of the panel i wont to disable something like a glass pane.. will that be possible? or can i put any means of transparent component on top of the panel and control that...

Charith I Fernando<br />SCJP5, SCWCD, SCBCD, BSc(Hons) IS<br />+94 773 263 222 (mobile)
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632

ignore the following - it relates only to the subject line, oblivious to this part of the post
"basically i dont wont to gray-out the components and disable the components"


maybe iterating the components in an overridden isEnabled() will work, then you just enable/disable the panel (or disable the panel's components in the
actionListener - whichever way suits)

something like this (may need a try/catch around the comp[x].setEnabled)

[ June 14, 2007: Message edited by: Michael Dunn ]
I agree. Here's the link:
subject: Solution to Disable a Panel
jQuery in Action, 3rd edition