How do you set the color scheme of a swing application?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Nate_Cox
Posted On:   Wednesday, November 6, 2002 01:29 AM

I'm trying to figure out how to set the color of the look and feel of a Java Swing application or applet. An example of what i'm talking about would be in the Java Web Start program you can access a program entitled "Swingset2app" and part of the menu is setting a "Theme".


can anyone tell me how this is done?

Re: How do you set the color scheme of a swing application?

Posted By:   michael_dean  
Posted On:   Wednesday, November 6, 2002 10:04 AM

Use the static setCurrentTheme(MetalTheme) method of the javax.swing.plaf.metal.MetalLookAndFeel class.



As far as creating the javax.swing.plaf.metal.MetalTheme objects, take a look at the source code for the SwingSet2 application (it's available at $JAVA_HOME/demo/jfc/SwingSet2/src)--specifically at AquaTheme.java, CharcoalTheme.java, ContrastTheme.java, EmeraldTheme.java, and RubyTheme.java (they're very intuitive to create once you've seen examples).

About | Sitemap | Contact