sajad
sajad

Reputation: 2174

java swing components: binding properties such as font and background color

I have a program in java with several Jpanels designed; with certain font and background color for each component on each of my panels. Is there any clean way to change font of jpanels and components on them? I mean I want to bind properties to my components; and as I changed the property; It's influence reflect on all of jpanels.

Upvotes: 3

Views: 833

Answers (2)

mKorbel
mKorbel

Reputation: 109813

You can use JComponent#putClientProperty(Object key, Object value) and this method could be used for multiple properties in one JComponent

Upvotes: 3

mikera
mikera

Reputation: 106351

You might want to investigate the use of different Look and Feels. This will allow you to change pretty much any properties of your components, and you can even change the loof & feel dynamically at runtime.

Also see the answers to this question: How do I get the default font for Swing JTabbedPane labels?

Upvotes: 3

Related Questions