Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JRadioButton and enable/disable the title of a titlebordered JPanel

 
Joe Vahabzadeh
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All,

I've got actually two questions, but they're both more or less an attempt to resolve the same problem.

1) If I have a JPanel with a TitledBorder, is there any way that I can have a JRadioButton actually be the title?

2) Alternately, I have a setup where I have a set of JRadioButtons, and beneath one of them is a JPanel that has a TitledBorder. When one of the JRadioButtons becomes unselected, I want to disable (and thus gray out) that entire JPanel. I know that I can't specifically disable the JPanel, so I do a getComponents on the JPanel and go through and disable all of them. However, is there any way to disable or gray out the actual Title of the JPanel's TitledBorder?


Thanks in advance.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1)
I think I've read somewhere this feature is available in java 1.6

2)
TitledBorder is one of the (very) few components that does not recognize
html in the String argument (where you can change the font color).

here's a couple of alternates
(this one will affect all titled borders)



or

 
Joe Vahabzadeh
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I'd actually seriously considered such a solution, but I'm told that I can't be guaranteed that the normal colors will apply (that is, I won't necessarily have a light background with black fonts and thus gray being applicable to the normal "disabled" look).

I was afraid that something like what you suggested might be the only thing available.

Also, unfortunately, I can't rely on anything 1.6 because I have to make sure everything's kosher with 1.4.2 (as an aside, 1.5 has made me so lazy with the ability to do things like Vector<String> and TreeSet<myObject> that being forced to do without them is incredibly irritating).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!