Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Solution to Disable a Panel

 
Charith Fernando
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[EDIT]

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"

[/EDIT]

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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic