Substance client properties

View all API methods.

View all client properties.


Client property name

SubstanceLookAndFeel.NO_EXTRA_ELEMENTS

Description

Property name for specifying that no extra UI elements (such as menu items in system menu or menu search panel) should be shown. This property can be set as either VM flag (no value needed) or as a global setting on UIManager. In the latter case, the value should be either Boolean.TRUE or Boolean.FALSE. Partial list of UI elements that will not be present when this property is specified:

  • System menu items
  • Menu search panel
  • Lock icon on non-editable text components


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;

/**
 * Test application that shows the use of the
 {@link SubstanceLookAndFeel#NO_EXTRA_ELEMENTS} client property.
 
 @author Kirill Grouchnikov
 @see SubstanceLookAndFeel#NO_EXTRA_ELEMENTS
 */
public class NoExtraElements extends JFrame {
  /**
   * Creates the main frame for <code>this</code> sample.
   */
  public NoExtraElements() {
    super("No extra elements");

    this.setLayout(new BorderLayout());

    JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    final JCheckBox noExtraElements = new JCheckBox("no extra elements");
    noExtraElements.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            // based on the checkbox selection status, set the
            // property
            UIManager.put(SubstanceLookAndFeel.NO_EXTRA_ELEMENTS,
                noExtraElements.isSelected() ? Boolean.TRUE
                    null);
            SwingUtilities
                .updateComponentTreeUI(NoExtraElements.this);
          }
        });
      }
    });
    controls.add(noExtraElements);
    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());
    JFrame.setDefaultLookAndFeelDecorated(true);
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        new NoExtraElements().setVisible(true);
      }
    });
  }
}

The screenshot below shows system menu when this property is not set. Note Substance-specific entries in the menu:

The screenshot below shows system menu when this property is set to Boolean.TRUE. Note that Substance-specific entries are gone: