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

voidsetJavaLookAndFeel()
set Java Look And Feel
try {
    UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
} catch (Exception e) {
    System.out.println("Error setting Java LAF: " + e);
voidsetJavaLookAndFeel()
set Java Look And Feel
try {
    UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
} catch (Exception e) {
voidsetLaf()
set Laf
try {
    UIManager.setLookAndFeel(NimbusLookAndFeel.class.getName());
    UIManager.put("Table.rowHeight", Integer.valueOf(25));
    NimbusLookAndFeel laf = (NimbusLookAndFeel) UIManager.getLookAndFeel();
    laf.getDefaults().put("defaultFont", new Font(Font.SANS_SERIF, Font.PLAIN, 16));
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException
        | UnsupportedLookAndFeelException e) {
    e.printStackTrace();
...
booleansetLAF(final String lafName)
Tries to set the specified Look and Feel.
for (final LookAndFeelInfo lookAndFeelInfo : UIManager.getInstalledLookAndFeels())
    if (lookAndFeelInfo.getName().equals(lafName))
        try {
            UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
            return true;
        } catch (final Exception e) {
            System.err.println("Failed to set " + lookAndFeelInfo.getName() + " look and feel!");
            e.printStackTrace(System.err);
...
voidsetLAF(String className)
Attempts to set the look and feel the specified class.
try {
    UIManager.setLookAndFeel(className);
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException
        | UnsupportedLookAndFeelException ex) {
voidsetLAF(String LAFName)
set LAF
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
    if (LAFName.equals(info.getName())) {
        javax.swing.UIManager.setLookAndFeel(info.getClassName());
        break;
voidsetLaf(String lafName)
Should be called before initComponents()
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
    if (info.getName().equals(lafName)) {
        try {
            UIManager.setLookAndFeel(info.getClassName());
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
                | UnsupportedLookAndFeelException e) {
        break;
...
voidsetLAFNimbus()
set LAF Nimbus
setLAF("Nimbus");
voidsetLookAndFeel()
set Look And Feel
try {
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
            UIManager.setLookAndFeel(info.getClassName());
            break;
} catch (Exception e) {
...
voidsetLookAndFeel()
set Look And Feel
try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e) {
    e.printStackTrace();
} catch (InstantiationException e) {
    e.printStackTrace();
} catch (IllegalAccessException e) {
    e.printStackTrace();
...