• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JRadioButton and enable/disable the title of a titlebordered JPanel

 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic