Substance API

View all API methods.

View all client properties.


API method

public static Map<String, ButtonShaperInfo> getAllButtonShapers()

Description

Returns all available button shapers.

Returns:

  • All available button shapers. Key - button shaper name, value - button shaper information.

See also


Sample code

import java.awt.*;
import java.util.Vector;

import javax.swing.*;

import org.jvnet.substance.SubstanceDefaultListCellRenderer;
import org.jvnet.substance.SubstanceLookAndFeel;
import org.jvnet.substance.button.ButtonShaperInfo;

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

    this.setLayout(new BorderLayout());

    final JPanel panel = new JPanel(new FlowLayout());
    // Get all button shapers and set the vector as a model
    // for combobox.
    final JComboBox cb = new JComboBox(new Vector<ButtonShaperInfo>(
        SubstanceLookAndFeel.getAllButtonShapers().values()));

    cb.setRenderer(new SubstanceDefaultListCellRenderer() {
      @Override
      public Component getListCellRendererComponent(JList list,
          Object value, int index, boolean isSelected,
          boolean cellHasFocus) {
        ButtonShaperInfo bsi = (ButtonShaperInfovalue;
        return super.getListCellRendererComponent(list, bsi
            .getDisplayName(), index, isSelected, cellHasFocus);
      }
    });
    panel.add(new JLabel("All button shapers:"));
    panel.add(cb);

    this.add(panel, BorderLayout.CENTER);

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

  /**
   * The main method for <code>this</code> sample. The arguments are
   * ignored.
   
   @param args
   *            Ignored.
   @throws Exception
   *             If some exception occured. Note that there is no special
   *             treatment of exception conditions in <code>this</code>
   *             sample code.
   */
  public static void main(String[] argsthrows Exception {
    UIManager.setLookAndFeel(new SubstanceLookAndFeel());
    JFrame.setDefaultLookAndFeelDecorated(true);
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        new GetAllButtonShapers().setVisible(true);
      }
    });
  }
}

The screenshot below shows a combo that lists all available button shapers: