Substance API

View all API methods.

View all client properties.


API method

public static Map<String, SkinInfo> getAllSkins()

Description

Returns all available skins.

Returns:

  • All available skins. Key - skin display name, value - skin information.

See also


Sample code

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.util.Vector;

import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

import org.pushingpixels.substance.api.SubstanceLookAndFeel;
import org.pushingpixels.substance.api.renderers.SubstanceDefaultComboBoxRenderer;
import org.pushingpixels.substance.api.skin.BusinessBlackSteelSkin;
import org.pushingpixels.substance.api.skin.SkinInfo;

/**
 * Test application that shows the use of the
 {@link SubstanceLookAndFeel#getAllSkins()} API.
 
 @author Kirill Grouchnikov
 @see SubstanceLookAndFeel#getAllSkins()
 */
public class GetAllSkins extends JFrame {
  /**
   * Creates the main frame for <code>this</code> sample.
   */
  public GetAllSkins() {
    super("Get all skins");

    setLayout(new BorderLayout());

    final JPanel panel = new JPanel(new FlowLayout());
    // Get all skins and set the vector as a model
    // for combobox.
    final JComboBox cb = new JComboBox(new Vector<SkinInfo>(
        SubstanceLookAndFeel.getAllSkins().values()));
    cb.setRenderer(new SubstanceDefaultComboBoxRenderer(cb) {
      @Override
      public Component getListCellRendererComponent(JList list,
          Object value, int index, boolean isSelected,
          boolean cellHasFocus) {
        SkinInfo si = (SkinInfovalue;
        return super.getListCellRendererComponent(list, si
            .getDisplayName(), index, isSelected, cellHasFocus);
      }
    });
    panel.add(new JLabel("All skins:"));
    panel.add(cb);

    this.add(panel, BorderLayout.CENTER);

    this.setSize(400200);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }

  /**
   * The main method for <code>this</code> sample. The arguments are ignored.
   
   @param args
   *            Ignored.
   */
  public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        SubstanceLookAndFeel.setSkin(new BusinessBlackSteelSkin());
        new GetAllSkins().setVisible(true);
      }
    });
  }
}

The screenshot below shows a combo that lists all available skins.