Substance client properties

View all API methods.

View all client properties.


Client property name

SubstanceLookAndFeel.WATERMARK_TO_BLEED

Description

Property name for requesting that watermark should bleed through lists, trees and tables. This is both a JVM flag and a client property on UIManager (global setting).

When this property is used as a JVM flag, there is no need to specify any value:

-Dsubstancelaf.watermark.tobleed

When this property is set a client property on UIManager, the value should be one of Boolean.TRUE or Boolean.FALSE.


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.jvnet.substance.SubstanceLookAndFeel;
import org.jvnet.substance.watermark.SubstanceBinaryWatermark;

/**
 * Test application that shows the use of the
 {@link SubstanceLookAndFeel#WATERMARK_TO_BLEED} client property.
 
 @author Kirill Grouchnikov
 @see SubstanceLookAndFeel#WATERMARK_TO_BLEED
 */
public class WatermarkToBleed extends JFrame {
  /**
   * Creates the main frame for <code>this</code> sample.
   */
  public WatermarkToBleed() {
    super("Watermark bleeding through the list");

    this.setLayout(new BorderLayout());

    // create list with a few values
    final JList jlist = new JList(new Object[] { "value1""value2",
        "value3""value4" });
    this.add(jlist, BorderLayout.CENTER);

    JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    final JCheckBox isBleeding = new JCheckBox("watermark bleed");
    isBleeding.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            // based on checkbox selection, mark the list to
            // bleed the watermark
            jlist.putClientProperty(
                SubstanceLookAndFeel.WATERMARK_TO_BLEED,
                isBleeding.isSelected() ? Boolean.TRUE : null);
            repaint();
          }
        });
      }
    });
    controls.add(isBleeding);
    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.
   @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());
    // set custom watermark
    SubstanceLookAndFeel
        .setCurrentWatermark(new SubstanceBinaryWatermark());
    JFrame.setDefaultLookAndFeelDecorated(true);
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        new WatermarkToBleed().setVisible(true);
      }
    });
  }
}

The screenshot below shows list with no watermark - this property is not set:

The screenshot below shows list with watermark (background color of list cell renderers is ignored) - this property is set to Boolean.TRUE: