Thursday, June 7, 2012

Synthetica Look And Feel Java Swing

19 comments

How to Apply Synthetica Look And Feel to JFrame in Netbeans


Here I am going to explain how to apply Synthetica Look And Feel to a JFrame in Netbeans,in the previous tutorial I was explained how to apply Nimbus Look and Feel Java Swing to a JFrame.You will be able to apply

  • SyntheticaSkyMetallicLookAndFeel
  • SyntheticaBlueMoonLookAndFeel
  • SyntheticaBlueIceLookAndFeel
  • SyntheticaWhiteVisionLookAndFeel
  • and SystemLookAndFeel which will your OS look and feel.
To apply Synthetica look and feel you must add Synthetica libraries to your project class path.

This code will remove your current look and feel which will help to apply new look and feel clearly.

UIManager.removeAuxiliaryLookAndFeel(UIManager.getLookAndFeel());

To apply new look and feel you must use this code snip which will update all Component with new look and feel

SwingUtilities.updateComponentTreeUI(this);



Look and Feel change function


private void changeLookandFeel() {
        try {

            UIManager.removeAuxiliaryLookAndFeel(UIManager.getLookAndFeel());
            SyntheticaLookAndFeel.setWindowsDecorated(false);
            UIManager.setLookAndFeel(UIMANAGER_STRING);

//             for (int i = 0; i < LookAndFeel.getFrames().length; ++i) {
//                SwingUtilities.updateComponentTreeUI(LookAndFeel.getFrames()[i]);
//                SwingUtilities.updateComponentTreeUI(this);
//            }
            SwingUtilities.updateComponentTreeUI(this);

        } catch (Exception ex) {
            try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

Synthetica Blue Moon Look And Feel

Synthetica Blue Moon Look And Feel

Synthetica Blue Moon Look And Feel


Synthetica White Vision Look And Feel

Synthetica White Vision Look And Feel

Synthetica White Vision Look And Feel


System Look And Feel (Windows 7)

System Look And Feel (Windows 7 Look And Feel)


Synthetica Sky Metallic Look And Feel

Synthetica Sky Metallic Look And Feel

Synthetica Sky Metallic Look And Feel


Synthetica Blue Ice Look And Feel

Synthetica Blue Ice Look And Feel

SyntheticaBlueIceLookAndFeel


Download the Netbean project from here Synthetica Look and Feel, you will be find libraries in the lib folder

 
Look And Feel Netbeans Project

19 comments:

Nikos Maravitsas said...

Hi Chathura,

Nice blog! Is there an email address I can contact you in private?

javin paul said...
This comment has been removed by the author.
javin paul said...

Indeed a nice tip. this can also be a good question one can ask to Java Swing developer, worth including in my list of Swing interview questions.

Chathura Wijesinghe said...

Hi Nikos I am on google plus you can add me..

Unknown said...

Chatura it show an exception that class not found..... in netbeans

Dev said...

What is the JDK version is it 7.0 ? use JDK 6

Unknown said...

Ok i'll try to use JDK 6 could you give me your email id to cantact you

Unknown said...

Thanks chatura it works in jdk 6 thankx alot

Rhythm Master said...

this article is really helpful Thank you man Thanks a lot :)

Unknown said...

i want to add this theams for JDK version is it 7.0,can u help me

Chathura Wijesinghe said...

@ Sajini Synthetica Standard Look and Feel support Java 1.5 or above

Unknown said...

i run error run:
Exception in thread "main" java.lang.NoClassDefFoundError: sun/swing/plaf/synth/SynthUI
at de.javasoft.plaf.synthetica.SyntheticaDefaultLookup.getDefault(SyntheticaDefaultLookup.java:96)
at sun.swing.DefaultLookup.get(DefaultLookup.java:125)
at javax.swing.plaf.basic.BasicButtonListener.getInputMap(BasicButtonListener.java:119)
at javax.swing.plaf.basic.BasicButtonListener.installKeyboardActions(BasicButtonListener.java:95)
at javax.swing.plaf.basic.BasicButtonUI.installKeyboardActions(BasicButtonUI.java:138)
at javax.swing.plaf.basic.BasicButtonUI.installUI(BasicButtonUI.java:90)
at javax.swing.JComponent.setUI(JComponent.java:664)
at javax.swing.AbstractButton.setUI(AbstractButton.java:1807)
at javax.swing.JButton.updateUI(JButton.java:146)
at javax.swing.AbstractButton.init(AbstractButton.java:2172)
at javax.swing.JButton.(JButton.java:136)
at javax.swing.JButton.(JButton.java:90)
at de.javasoft.plaf.synthetica.SyntheticaLookAndFeel.installCompatibilityDefaults(SyntheticaLookAndFeel.java:679)
at de.javasoft.plaf.synthetica.SyntheticaLookAndFeel$2.propertyChange(SyntheticaLookAndFeel.java:345)
at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(SwingPropertyChangeSupport.java:92)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:541)
at jsupport.lookandfeel.Main.main(Main.java:17)
Caused by: java.lang.ClassNotFoundException: sun.swing.plaf.synth.SynthUI
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 20 more
Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds)

Chathura Wijesinghe said...

did you add the libraries correctly

Unknown said...

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: de/javasoft/plaf/synthetica/SyntheticaLookAndFeel
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:249)
at javax.swing.SwingUtilities.loadSystemClass(SwingUtilities.java:1850)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:557)
at Tela.(Tela.java:26)
at Tela$1.run(Tela.java:107)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:672)
at java.awt.EventQueue.access$400(EventQueue.java:81)
at java.awt.EventQueue$2.run(EventQueue.java:633)
at java.awt.EventQueue$2.run(EventQueue.java:631)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:642)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.ClassNotFoundException: de.javasoft.plaf.synthetica.SyntheticaLookAndFeel
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 32 more

Unknown said...

i'm using JDK 6u45 but dont work, i need some help. Add me on facebook: https://www.facebook.com/alex.camaroti

Chathura Wijesinghe said...

Did you run my project?

Download the Netbean project from here Synthetica Look and Feel, you will be find libraries in the lib folder

Unknown said...

Hi..chathura,
I am not able to download your project.

Dev said...

@Bhargav download the project from here Synthetica Look and Feel

Anuja Jadhav said...

I run in to the same error Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: de/javasoft/plaf/synthetica/SyntheticaLookAndFeel . I am using JDK 7. I cannot use a lower version.

Post a Comment