How to change the Look and Feel of an application?

1

Can anyone explain how I can change the layout of my application's windows?

I was building the application and testing the main method normally, but since it took a long time to wait to connect to the server and still have to log in every time I wanted to test a function, I created a main method I did not want to do it, since it's just starting with the main that stays normal, I just want to know if I can choose between other models.

>

The difference is in the images below:

This is the original

Andthisishowitwaslater:

    
asked by anonymous 26.08.2016 / 18:55

1 answer

3

The original format uses the look and feel Nimbus , then it's the Java standard. You can programmatically select the look and feel of your application as follows:

try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
    if ("Nimbus".equals(info.getName())) {
        UIManager.setLookAndFeel(info.getClassName());
        break;
    }
}
} catch (Exception e) {
   // If Nimbus is not available, you can set the GUI to another look and feel.
}

The loop iterates through all supported looks and feels and when it finds Ninbus selects for your application. I hope I have helped ^^

    
01.09.2016 / 13:50