Returns a list of available Swing Look and Feels - Java Swing

Java examples for Swing:Look and Feel

Description

Returns a list of available Swing Look and Feels

Demo Code

/*//from w  w w.j  a  va  2  s .  c  o m
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
//package com.java2s;
import java.util.ArrayList;
import java.util.List;

import javax.swing.UIManager;

public class Main {
    /**
     * Returns a list of available Swing Look and Feels
     * @return a collection of installed Look And Feels
     */
    public static List<String> getAvailableLookAndFeels() {
        ArrayList<String> availableLookAndFeels = new ArrayList<>(5);

        for (UIManager.LookAndFeelInfo lafInfo : UIManager
                .getInstalledLookAndFeels()) {
            availableLookAndFeels.add(lafInfo.getName());
        }
        return availableLookAndFeels;
    }
}

Related Tutorials