Substance client properties

View all API methods.

View all client properties.


Client property name

SubstanceLookAndFeel.TABBED_PANE_CONTENT_BORDER_KIND

Description

Client property name for specifying the content pane border kind. This property can be specified either on a single JTabbedPane or on UIManager. The value should be one of SubstanceConstants.TabContentPaneBorderKind enum. By default, the border kind is SubstanceConstants.TabContentPaneBorderKind.DOUBLE_FULL.


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.ImageIcon;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities;

import org.pushingpixels.substance.api.SubstanceLookAndFeel;
import org.pushingpixels.substance.api.SubstanceConstants.TabContentPaneBorderKind;
import org.pushingpixels.substance.api.skin.BusinessBlackSteelSkin;

/**
 * Test application that shows the use of the
 {@link SubstanceLookAndFeel#TABBED_PANE_CONTENT_BORDER_KIND} client property.
 
 @author Kirill Grouchnikov
 @see SubstanceLookAndFeel#TABBED_PANE_CONTENT_BORDER_KIND
 */
public class TabbedPaneContentBorderKind extends JFrame {
  /**
   * Creates the main frame for <code>this</code> sample.
   */
  public TabbedPaneContentBorderKind() {
    super("Tabbed pane content border kind");

    this.setLayout(new BorderLayout());

    // create tabbed pane with a few tabs
    final JTabbedPane jtp = new JTabbedPane();
    String packageName = TabbedPaneContentBorderKind.class.getPackage()
        .getName();
    jtp.addTab("First"new ImageIcon(TabbedPaneContentBorderKind.class
        .getClassLoader().getResource(
            packageName.replace('.''/'"/flag_mexico.png")),
        new JPanel());
    jtp.addTab("Second"new ImageIcon(TabbedPaneContentBorderKind.class
        .getClassLoader().getResource(
            packageName.replace('.''/'"/flag_sweden.png")),
        new JPanel());
    jtp
        .addTab("Third"new ImageIcon(
            TabbedPaneContentBorderKind.class.getClassLoader()
                .getResource(
                    packageName.replace('.''/')
                        "/flag_hong_kong.png")),
            new JPanel());

    this.add(jtp, BorderLayout.CENTER);

    JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    final JComboBox contentBorderCombo = new JComboBox(new Object[] {
        TabContentPaneBorderKind.DOUBLE_FULL,
        TabContentPaneBorderKind.SINGLE_FULL,
        TabContentPaneBorderKind.DOUBLE_PLACEMENT,
        TabContentPaneBorderKind.SINGLE_PLACEMENT });
    contentBorderCombo
        .setSelectedItem(TabContentPaneBorderKind.DOUBLE_FULL);
    contentBorderCombo.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        TabContentPaneBorderKind contentBorderKind = (TabContentPaneBorderKindcontentBorderCombo
            .getSelectedItem();
        jtp.putClientProperty(
            SubstanceLookAndFeel.TABBED_PANE_CONTENT_BORDER_KIND,
            contentBorderKind);
        jtp.updateUI();
        jtp.repaint();
      }
    });

    controls.add(new JLabel("Content border kind"));
    controls.add(contentBorderCombo);
    this.add(controls, BorderLayout.SOUTH);

    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.
   */
  public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        SubstanceLookAndFeel.setSkin(new BusinessBlackSteelSkin());
        new TabbedPaneContentBorderKind().setVisible(true);
      }
    });
  }
}

The screenshot below shows tabbed pane with top placement and default (double full) content border kind - this property is not specified:

The screenshot below shows tabbed pane with top placement and SubstanceConstants.TabContentPaneBorderKind.SINGLE_FULL content border kind:

The screenshot below shows tabbed pane with top placement and SubstanceConstants.TabContentPaneBorderKind.DOUBLE_PLACEMENT content border kind:

The screenshot below shows tabbed pane with top placement and SubstanceConstants.TabContentPaneBorderKind.SINGLE_PLACEMENT content border kind: