03 | 09 | 2010
Main Menu
Affiliates
Who's Online
We have 24 guests online
Alexa
Spice Up Your Swing UI with Substance
Java Concepts
Written by Phoenix   
Tuesday, 27 May 2008 18:03

Rating 2.3/5 (18 votes)

Give your Swing applications a cool look and feel with Substance. Substance Java look & feel is a project to provide a modern look & feel that combines graphic ideas from Windows XP / Vista and MacOS 10.4. This look & feel is available for JDK 5.0+ only. You can download substance from substance.dev.java.net

 

Java Swings provides pluggable look and feel, you can change the look and feel of your swing applications with very little change.


To set a look and feel, you can either pass the look and feel class name as a JVM parameter


-Dswing.defaultlaf= look and feel class name
For Example:
java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel MyApp


Or You can set the look and feel from your code.


UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
For Example:
UIManager.setLookAndFeel("look and feel class name");

 


Java comes with four look and feel classes
Metal (Default): javax.swing.plaf.metal.MetalLookAndFeel
GTK+ Style: com.sun.java.swing.plaf.gtk.GTKLookAndFeel
Motif Style: com.sun.java.swing.plaf.motif.MotifLookAndFeel
Windows Style: com.sun.java.swing.plaf.windows.WindowsLookAndFeel


The Substance library adds many more cool L&F to java applications.

These look and feels provide many additional

features which the built in look and feels do not have:


1) Themed Title Bar


2) Configurable Button Shapes


3) Rollover Animation Effects for most widgets
4) Animated Progress bars
5) Tabs with vista style preview tooltips

6) Searchable Menus

7) Water Mark / Background Image

8) Heap Status Display

9) About 20 Themes You can check out the screen shots here https://substance.dev.java.net/docs/themes/simple.html

12) Many More…

Some Sample Screenshots:


In order to use Substance look and feel in your application, you can use one of the following:

* UIManager.setLookAndFeel(new SubstanceLookAndFeel());

* UIManager.setLookAndFeel("org.jvnet.substance.SubstanceLookAndFeel");

* Start your VM with -Dswing.defaultlaf=org.jvnet.substance.SubstanceLookAndFeel

 

This will use the substance look and feel with the default AQUA theme.

In order to change the current theme, you can call SubstanceLookAndFeel.setCurrentTheme() with one of the above themes,

for example SubstanceLookAndFeel.setCurrentTheme(new SubstanceBrownTheme())



Call SubstanceLookAndFeel.setCurrentTheme() with the fully qualified name of one of the above themes,

for example SubstanceLookAndFeel.setCurrentTheme ("org.jvnet.substance.theme.SubstanceBrownTheme")



Set substancelaf.theme parameter of the VM,

for example -Dsubstancelaf.theme=org.jvnet.substance.theme.SubstanceBrownTheme



If you use one of the first two options after your application has started, don't forget to call:

UIManager.setLookAndFeel(new SubstanceLookAndFeel());

SwingUtilities.updateComponentTreeUI(...);

The first call is mandatory in versions 2.2, 2.3 and 3.0.

The second call should be performed on all open frames (you can use Frame.getFrames() function).


Add this page to your favorite Social Bookmarking websites
Reddit! Del.icio.us! JoomlaVote! Google! Live! Facebook! StumbleUpon! Yahoo! Free social bookmarking plugins and extensions for Joomla! websites!
Comments
Search
MethoD  - Help!     |202.170.95.xxx |2008-05-28 04:18:25
I cannot change the JFrame title bar.
I followed the instruction but JFrame
title bar didn't change.
Vimal  - use -Dsubstancelaf.useDecorations   |203.197.168.xxx |2008-05-28 06:24:42
Use the VM flag -Dsubstancelaf.useDecorations to decorate the frames.

________________
If specified, all frames and dialogs will be created with
custom title panes. No value is needed. For
example,

-Dsubstancelaf.useDecorations
Substance   |203.197.168.xxx |2008-05-29 01:24:15
In case you wish to use cross-platform frame and dialog decorations, use the
following before you instantiate your first top-level window:
JFrame.setDefaultLookAndFeelDecorated(true); and
JDialog.setDefaultLookAndFeelDecorated(true);. This, however, causes flicker on
resize due to a known Swing bug. For Windows, there is a workaround, using
System.setProperty("sun.awt.noerasebackground& #34;, "true";. You
can set this property along with the above two lines.
MethoD  - Thank you!     |202.170.95.xxx |2008-05-29 01:37:42
JJFrame.setDefaultLookAndFeelDecorated(true);
fixe d my problem. Thank you very
much. My title bar is now decorated.
Only registered users can write comments!

3.22 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated ( Tuesday, 27 May 2008 19:19 )
 
Bottom Ad
Your Ad Here