Results 1 to 6 of 6

Thread: How to change the Look and Feel in Java?

  1. #1
    Join Date
    Aug 2006
    Posts
    222

    How to change the Look and Feel in Java?

    Hi friends,
    I have done some basic programming language like C++ and C#. Recently I have started Java. I have done some basic coding in Java. But I never heard about the Look and Feel that are used in Java. I have been told to change the Look and Feel, which I don't know.!! So thought that posting here would help me. So please tell me how to change the Look and Feel in Java.?? Please tell me as soon as possible.!!
    Just a reply to say thank you for these links and posts I have a lot to read and learn now!



  2. #2
    Join Date
    Mar 2008
    Posts
    349

    Re: How to change the Look and Feel in Java?

    I think that you have never heard about the feels and looks because it is not so important part of Java when it is considered as programming language. But you should know that the architecture of Swing is designed so that you may change the "look and feel" of your application's GUI. In Java you can change the looks and feels by using the Swing. The Swing UI manager must figure out which look and feel to use when a program does not set its look and feel. Swing's architecture enables multiple L&Fs by separating every component into two distinct classes: a JComponent subclass and a corresponding ComponentUI subclass.

  3. #3
    Join Date
    Apr 2008
    Posts
    1,948

    Re: How to change the Look and Feel in Java?

    You can easily run the programs with your preferred look and feel. If you want to change the look and feel, you can use the following coding. The code that is mentioned below will give your Java application a Windows look and feel :
    Code:
    UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    	//Ensure the class //"com.sun.java.swing.plaf.windows.WindowsLookAndFeel" is
    i//n your jvm bootstrap classpath. Mostly it can be found in your
    //jdk/jre/lib/rt.jar
    //For metal look and feel
    	import javax.swing.plaf.metal.*;
            UIManager.setLookAndFeel(new MetalLookAndFeel());

  4. #4
    Join Date
    Jul 2006
    Posts
    286

    Re: How to change the Look and Feel in Java?

    You can use any look and feel that's in your program's class path. You can get the following looks and feels in Java. These are provided by the Sun's JRE. The following are the looks and feels :
    1. SystemLookAndFeel - If you are using this, then the application uses the look and feel which is native to the system it is running on. The System look and feel is determined at runtime, where the application asks the system to return the name of the appropriate look and feel.
    2. CrossPlatformLookAndFeel - This look is also called as "Metal". This is the Java Look and Feel that looks the same on all platforms. Also this same looks come when you are doing nothing in your code to set a different looks and feels.
    3. Synth - You can use this as basis for creating your own look and feel with an XML file.
    IF you hate me, please don't mention it. I know who hates me and who doesn't. You really do not have to make fun of people....

  5. #5
    Join Date
    Aug 2006
    Posts
    227

    Re: How to change the Look and Feel in Java?

    You can use the following code for changing the look and feel of the application in Java. The underlined code in the following snippet makes the program use the cross-platform Java look and feel :
    Code:
    public static void main(String[] args) {
        try {
            UIManager.setLookAndFeel(
                UIManager.getCrossPlatformLookAndFeelClassName());
        } 
        catch (UnsupportedLookAndFeelException e) {
        }
        catch (ClassNotFoundException e) {
        }
        catch (InstantiationException e) {
        }
        catch (IllegalAccessException e) {
        }
    	
        new SwingApplication(); 
    }
    I do to dead flowers what people at morgues do to dead people. Suck all the moisture out, dip them in plastic, paint them up pretty and put them in a nice frame.

  6. #6
    Join Date
    Jul 2006
    Posts
    289

    Re: How to change the Look and Feel in Java?

    The argument to setLookAndFeel is the fully qualified name of the appropriate subclass of LookAndFeel. If you want to specify the looks and feels at the command line, then you can do this by using the -D flag to set the swing.defaultlaf property. For doing that, you may get help from the following example :
    Code:
    java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel MyApp
    Signatures reduce available bandwidth

Similar Threads

  1. Look and feel in JAVA
    By Karumbu in forum Software Development
    Replies: 4
    Last Post: 24-12-2010, 08:48 AM
  2. How to use Nimbus Look and Feel in Java?
    By super soaker in forum Software Development
    Replies: 5
    Last Post: 14-02-2010, 02:10 AM
  3. Change a file TimeStamp in Java
    By REDBULL in forum Software Development
    Replies: 3
    Last Post: 30-11-2009, 11:46 AM
  4. How to change font in java using Swing?
    By Coldman in forum Software Development
    Replies: 3
    Last Post: 17-11-2009, 11:06 AM
  5. Change Color Schemes in Java
    By NetWorm in forum Software Development
    Replies: 1
    Last Post: 10-03-2009, 01:37 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,262,869.41643 seconds with 17 queries