Substance client properties

View all API methods.

View all client properties.


Client property name

SubstanceLookAndFeel.PAINT_ACTIVE_PROPERTY

Description

Client property name for specifying that a single control / all application controls should always be painted in active color (unless a control is disabled). This property can be set either as a client property on a specific control or as a global setting on UIManager. The value should be either Boolean.TRUE or Boolean.FALSE.


See also


Sample code

import java.awt.FlowLayout;

import javax.swing.*;

import org.jvnet.substance.SubstanceLookAndFeel;

/**
 * Test application that shows the use of the
 {@link SubstanceLookAndFeel#PAINT_ACTIVE_PROPERTY} client property.
 
 @author Kirill Grouchnikov
 @see SubstanceLookAndFeel#PAINT_ACTIVE_PROPERTY
 */
public class PaintActiveProperty extends JFrame {
  /**
   * Creates the main frame for <code>this</code> sample.
   */
  public PaintActiveProperty() {
    super("Middle button always painted active");

    this.setLayout(new FlowLayout());

    JButton buttonA = new JButton("a");

    JButton buttonB = new JButton("b");
    // mark button as always painted in active state
    buttonB.putClientProperty(SubstanceLookAndFeel.PAINT_ACTIVE_PROPERTY,
        Boolean.TRUE);

    JButton buttonC = new JButton("c");

    this.add(buttonA);
    this.add(buttonB);
    this.add(buttonC);

    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 PaintActiveProperty().setVisible(true);
      }
    });
  }
}

The screenshot below shows application frame with middle button marked with this property set to Boolean.TRUE (note that the mouse is not over the button):