Substance API

View all API methods.

View all client properties.


API method

public static void permanentlyHideHeapStatusPanel(JRootPane pane)

Description

Makes the heap status panels disappear permanently on the specified title pane and removes the corresponding check box menu items from the system menu.

Parameters:

  • pane - The root pane.

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#permanentlyHideHeapStatusPanel(JRootPane)} and
 {@link SubstanceLookAndFeel#permanentlyShowHeapStatusPanel(JRootPane)} API.
 
 @author Kirill Grouchnikov
 @see SubstanceLookAndFeel#permanentlyHideHeapStatusPanel(JRootPane)
 @see SubstanceLookAndFeel#permanentlyShowHeapStatusPanel(JRootPane)
 */
public class PermanentlyHideShowHeapStatusPanel extends JFrame {
  /**
   * Creates the main frame for <code>this</code> sample.
   */
  public PermanentlyHideShowHeapStatusPanel() {
    super("Permanently hide / show heap status panel");

    this.setLayout(new BorderLayout());

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

    controls.add(new JLabel("Permanent status of heap status panel"));
    final JButton permanentlyShow = new JButton("Show");
    final JButton permanentlyHide = new JButton("Hide");
    permanentlyHide.setEnabled(false);
    permanentlyShow.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        SubstanceLookAndFeel
            .permanentlyShowHeapStatusPanel(getRootPane());
        permanentlyShow.setEnabled(false);
        permanentlyHide.setEnabled(true);
      }
    });
    permanentlyHide.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        SubstanceLookAndFeel
            .permanentlyHideHeapStatusPanel(getRootPane());
        permanentlyHide.setEnabled(false);
        permanentlyShow.setEnabled(true);
      }
    });

    controls.add(permanentlyShow);
    controls.add(permanentlyHide);
    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 {
    if (System.getProperty("substancelaf.heapStatusPanel"== null) {
      System.err
          .println("Please run with -Dsubstancelaf.heapStatusPanel");
      System.exit(-1);
    }

    UIManager.setLookAndFeel(new SubstanceLookAndFeel());
    JFrame.setDefaultLookAndFeelDecorated(true);

    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        new PermanentlyHideShowHeapStatusPanel().setVisible(true);
      }
    });
  }
}

The screenshot below shows application frame run under -Dsubstancelaf.heapStatusPanel VM flag when this API is not called. Note the menu item entry in the application (system) menu that allows toggling the heap status panel:

The screenshot below shows application frame run under -Dsubstancelaf.heapStatusPanel VM flag after this API has not called. Note that the above-mentioned menu item is gone and the heap status panel is not showing: