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

voidapplyNimbusLaF()
apply Nimbus La F
try {
    UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
    UIManager.put("nimbusSelectionBackground", new Color(173, 207, 231));
} catch (Exception e) {
    e.printStackTrace();
StringapplyStartupLookAndFeel(String desiredLafClassName)
Try to apply the specified look and feel.
try {
    String clsName = desiredLafClassName;
    UIManager.setLookAndFeel(clsName);
    return clsName;
} catch (Exception e) {
try {
    String clsName;
...
voidcheckGTKLookAndFeel()
Look and feel improvement on Ubuntu http://stackoverflow.com/questions/3907047/how-to-change-the-default-font -size-in-the-swing-gtk-lookandfeel/31345102#31345102
final LookAndFeel look = UIManager.getLookAndFeel();
if (!look.getID().equals("GTK"))
    return;
new JFrame();
new JButton();
new JComboBox<>();
new JRadioButton();
new JCheckBox();
...
booleancheckThemeLiscense(LookAndFeelInfo i)
A static method for blocking the Quaqua theme from working with any OS but OSX.
String osName = System.getProperty("os.name").toLowerCase();
String suitableName = i.getName();
if (suitableName.startsWith("Quaqua") && !osName.startsWith("mac os x")) {
    return false;
return true;
booleancomputeIsLafAqua()
Computes and answers whether an Aqua look&feel is active.
return UIManager.getLookAndFeel().getID().equals("Aqua");
voiddefaultLookAndFeel()
default Look And Feel
try {
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if (DEFAULT_LOOK_AND_FEEL.equals(info.getName())) {
            UIManager.setLookAndFeel(info.getClassName());
            break;
} catch (Exception e) {
...
voidenableLafIfAvailable(String lafName)
Enables look and feel with specified name only if such LaF is available
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
    if (lafName.equals(info.getName())) {
        try {
            UIManager.setLookAndFeel(info.getClassName());
            break;
        } catch (Exception e) {
voidfixLnF()
fix Ln F
final Object osName = System.getProperties().get("os.name");
if (!osName.equals("Mac OS X")) {
    loadPlasticLnF();
LookAndFeelInfo[]getAvailableLookAndFeels()
get Available Look And Feels
return Arrays.copyOf(availableLookAndFeels, availableLookAndFeels.length);
ListgetAvailableLookAndFeels()
Returns a list of available Swing Look and Feels
ArrayList<String> availableLookAndFeels = new ArrayList<>(5);
for (UIManager.LookAndFeelInfo lafInfo : UIManager.getInstalledLookAndFeels()) {
    availableLookAndFeels.add(lafInfo.getName());
return availableLookAndFeels;