Look and Feel

308 5 1
                                        

So, now we've got this cool program, but it looks kinda ugly. And there is a way to fix that, through the UIManager class. If you type

for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {

            if ("Nimbus".equals(info.getName())) {

                UIManager.setLookAndFeel(info.getClassName());

            }

            System.out.println(info.getName());

        }

At the top be sure to put

import javax.swing.UIManager;

import javax.swing.UIManager.LookAndFeelInfo;

When you run the application, it will print out all the installed look and feels you have. I perfer nimbus, as do most people. However, there may be another you like. If you want your application to look like a native one, simply put

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

Next chapter, I'll start looking at adding functionality for the program.

Has llegado al final de las partes publicadas.

⏰ Última actualización: Apr 06, 2013 ⏰

¡Añade esta historia a tu biblioteca para recibir notificaciones sobre nuevas partes!

Java Swing GUI DevelopmentDonde viven las historias. Descúbrelo ahora