How to add Look And Feel Theme.

in here i am going to say you about new thing related to you. Maybe you already have listened this.When you develop GUI application all the time you got same theme for your java applications. Actually when I am doing my university second year project I wanted to do something new to my project. I wanted to change the default theme of the project and I got a solution. Solution is java Look and feel themes. You these theme libraries you can get new look to your java application. If you want to know more about this topic search in browser under key word how to add java look and feel themes.

I have created simple application and there are two classes in my application. One is main class and another class is my GUI window with several swing widgets. To add theme to your application you better to add it inside the main class’s main method. See my main class below

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/ 

package lookandfeel;

import javax.swing.JOptionPane;

/**
*
* @author Developer
*/
public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {

try
{
//import customized  look and feel theme
javax.swing.UIManager.setLookAndFeel("com.jtattoo.plaf.graphite.GraphiteLookAndFeel");

//main window visible

new LookandFeel().setVisible(true);

}
catch(Exception ex){

//if error occured describe and display it in joption pane

JOptionPane.showMessageDialog(null, ex.getMessage(), "Example",JOptionPane.ERROR_MESSAGE);
}

}

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s