Java Utililty Methods Swing Look and Feel

List of utility methods to do Swing Look and Feel

Description

The list of methods to do Swing Look and Feel are organized into topic(s).

Method

booleanmatchLnf(LookAndFeel lookAndFeel, UIManager.LookAndFeelInfo lookAndFeelInfo)
Do the supplied l&f object and l&f info object refer to the same l&f?
return lookAndFeel.getClass().getName().equals(lookAndFeelInfo.getClassName());
voidmetalLookAndFeel()
metal Look And Feel
try {
    UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
} catch (ClassNotFoundException e) {
    throw new UnsupportedOperationException("Fix This"); 
} catch (InstantiationException e) {
    throw new UnsupportedOperationException("Fix This"); 
} catch (IllegalAccessException e) {
    throw new UnsupportedOperationException("Fix This"); 
...
booleannativeLook()
native Look
try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    return true;
} catch (Exception ex) {
    return false;
voidprintInstalledLookAndFeel()
Prints the installed look and feel.
final LookAndFeelInfo[] look = UIManager.getInstalledLookAndFeels();
for (final LookAndFeelInfo lookAndFeelInfo : look) {
    System.out.println(lookAndFeelInfo.getClassName());
voidprintInstalledPLAFs()
print Installed PLA Fs
UIManager.LookAndFeelInfo plaf[] = UIManager.getInstalledLookAndFeels();
for (int i = 0, n = plaf.length; i < n; i++) {
    System.out.println("Name: " + plaf[i].getName());
    System.out.println("  Class name: " + plaf[i].getClassName());
voidsetBestLookAndFeelAvailable()
set Best Look And Feel Available
String system_lf = UIManager.getSystemLookAndFeelClassName().toLowerCase();
if (system_lf.contains("metal")) {
    try {
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
    } catch (Exception e) {
} else {
    try {
...
booleansetCoolLookAndFeel()
Tries to set the NimbusLookAndFeel or (if Nibus is not available) the OS like LookAndFeel
return (setNimbusLookAndFeel() || setSystemLookAndFeel());
voidsetDefaultLookAndFeel()
Set the system default look and feel.
try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
voidsetDefaultLookandfeel()
Calls UIManager#setLookAndFeel(javax.swing.LookAndFeel) with UIManager#getSystemLookAndFeelClassName()
try {
    setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
    e.printStackTrace();
voidsetJavaLookAndFeel()
set Java Look And Feel
try {
    UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
} catch (Exception e) {
    System.out.println("Error setting Java LAF: " + e);