user843337
user843337

Reputation:

What steps do I need to take in order to change the 'look and feel' of java swing GUI?

I have just found a nice look that I would like to use for my programs appearance however I'm unsure of how to integrate it. This is the look i'm after:

AcrylLookAndFeel

I have managed to find the website and download a jar file which I have included in my build path. I have also found the following line of code which I have included:

UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel");

When I run it I don't get any errors, however it doesn't look anything like the image. Have I missed out steps? What do I need to do?

One other concern I have is that I'm currently working on a mac, however I want the appearance to be consistent regardless of whether I run my program on a mac or on windows. Is this even possible? If so please could you advise how to do this (if any changes are required)?

Upvotes: 3

Views: 783

Answers (3)

gabriel
gabriel

Reputation: 1

Before you create your JFrame:

// setup the look and feel properties
Properties props = new Properties();

// set your theme
SmartLookAndFeel.setCurrentTheme(props);
// select the Look and Feel
UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel");

Upvotes: 0

Panfilo Santiago
Panfilo Santiago

Reputation: 1

import org.jvnet.substance.SubstanceLookAndFeel;

public class Main {

    public static void main(String[] args) {
       /*Si no se tiene instalado la libreria Substance*/
       //formpadre fp= new formpadre();
       //fp.show();

        /*si la libreria substance esta instalada y configurada*/               
        EventQueue.invokeLater(new Runnable(){
        public void run(){
            try{
                JFrame.setDefaultLookAndFeelDecorated(true);                
                SubstanceLookAndFeel.setSkin("org.jvnet.substance.skin.BusinessBlueSteelSkin");            //SubstanceLookAndFeel.setCurrentTheme("org.jvnet.substance.theme.SubstanceAquaTheme");   
            }              
            catch(Exception e){
            }               
            new formpadre().setVisible(true);
        }
        });            
    }
}

Upvotes: 0

Brandon Buck
Brandon Buck

Reputation: 7181

Setting the Swing look and feel in Java carries over between operating systems. I've always only ever done it before I created my Swing GUI.

public static void main(String[] args) {
    try {    
        UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel");
    } 
    // Probably want to break this into handling the various exceptions that can be thrown.
    catch (Exception e) {
       // handle exception
    }

    // Create Swing GUI and so forth
}

Upvotes: 2

Related Questions