Substance API

View all API methods.

View all client properties.

API method

public static DecorationAreaType getDecorationType(Component comp)


Returns the decoration area type of the specified component. The component and its ancestor hierarchy are scanned for the registered decoration area type. If setDecorationType(JComponent, DecorationAreaType) has been called on the specified component, the matching decoration type is returned. Otherwise, the component hierarchy is scanned to find the closest ancestor that was passed to setDecorationType(JComponent, DecorationAreaType) - and its decoration type is returned. If neither the component, nor any one of its parent components has been passed to the setter method, DecorationAreaType#NONE is returned.


  • comp - Component.


  • Decoration area type of the component.

See also

Sample code

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

import org.pushingpixels.substance.api.DecorationAreaType;
import org.pushingpixels.substance.api.SubstanceLookAndFeel;

 * Test application that shows the use of the
 {@link SubstanceLookAndFeel#getDecorationType(java.awt.Component)} API called
 * on different components.
 @author Kirill Grouchnikov
 @see SubstanceLookAndFeel#getDecorationType(java.awt.Component)
public class GetDecorationType extends JFrame {
   * Creates the main frame for <code>this</code> sample.
  public GetDecorationType() {
    super("Get decoration type");

    this.setLayout(new BorderLayout());

    final JTabbedPane tabs = new JTabbedPane();
    SubstanceLookAndFeel.setDecorationType(tabs, DecorationAreaType.HEADER);

    JPanel tab1 = new JPanel(new FlowLayout());
    tab1.add(new JTextField("sample"));
    final JComboBox combo = new JComboBox(new Object[] { "sample" });
        .setDecorationType(tab1, DecorationAreaType.GENERAL);

    JPanel tab2 = new JPanel(new FlowLayout());
    tab2.add(new JTextField("sample2"));
    tab2.add(new JComboBox(new Object[] { "sample2" }));
        .setDecorationType(tab2, DecorationAreaType.GENERAL);

    tabs.addTab("tab1", tab1);
    tabs.addTab("tab2", tab2);

    this.add(tabs, BorderLayout.CENTER);

    JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    JButton getTypes = new JButton("Get types");
    getTypes.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            DecorationAreaType tabsType = SubstanceLookAndFeel
            DecorationAreaType comboType = SubstanceLookAndFeel
                "Tabbed pane: " + tabsType.getDisplayName()
                    "\n" "Combo box: "
                    + comboType.getDisplayName());

    this.add(controlPanel, BorderLayout.SOUTH);


   * The main method for <code>this</code> sample. The arguments are ignored.
   @param args
   *            Ignored.
  public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        SubstanceLookAndFeel.setSkin(new BusinessBlueSteelSkin());
        UIManager.put("TabbedPane.contentOpaque", Boolean.TRUE);
        new GetDecorationType().setVisible(true);

The screenshot below shows application frame with a tabbed pane. The tabbed pane is marked with to be DecorationAreaType.HEADER and all the tabs are marked with DecorationAreaType.GENERAL:

When this API is called on the tabbed pane, it returns DecorationAreaType.HEADER. When it is called on the combobox inside the first tab, it returns DecorationAreaType.GENERAL (which is set on its parent tab):