Alberto’s posterous

« Back to blog
July 23, 2008

Java e i Look And Feel

Scegliere il LookAndFeel:

String lookAndFeel = null;
lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName();
lookAndFeel = UIManager.getSystemLookAndFeelClassName();
lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";


LookAndFeel esistenti di default in java:

Base: UIManager.getCrossPlatformLookAndFeelClassName();
System: UIManager.getSystemLookAndFeelClassName();
Motif: com.sun.java.swing.plaf.motif.MotifLookAndFeel";
GTK: com.sun.java.swing.plaf.gtk.GTKLookAndFeel";


Settare il LookAndFeel:

UIManager.setLookAndFeel(lookAndFeel);

Per il LookAndFeel Metale si posso scegliere diversi temi:

DefaultMetal: MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
Ocean: MetalLookAndFeel.setCurrentTheme(new OceanTheme());


Per modificare il LookAndFeel anche della finestra (di default usa quella dell'SO):

JFrame.setDefaultLookAndFeelDecorated(true);



Comments (0)
Leave a comment...
 
Got a posterous account already? Login