Example usage for javax.swing JMenuBar setMaximumSize

List of usage examples for javax.swing JMenuBar setMaximumSize

Introduction

In this page you can find the example usage for javax.swing JMenuBar setMaximumSize.

Prototype

@BeanProperty(description = "The maximum size of the component.")
public void setMaximumSize(Dimension maximumSize) 

Source Link

Document

Sets the maximum size of this component to a constant value.

Usage

From source file:savant.view.swing.Savant.java

private void initHiddenShortcuts() {
    JMenuBar hiddenBar = new JMenuBar();
    hiddenBar.setSize(new Dimension(0, 0));
    hiddenBar.setMaximumSize(new Dimension(0, 0));
    hiddenBar.setPreferredSize(new Dimension(0, 0));

    JMenuItem hiddenBookmarkPrev = new JMenuItem("");
    hiddenBookmarkPrev.setAccelerator(/*  w  w w  . j a  v  a  2 s .  c o  m*/
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_9, MiscUtils.MENU_MASK));
    hiddenBookmarkPrev.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            if (favoriteSheet != null) {
                favoriteSheet.goToPreviousBookmark();
            }
        }
    });

    JMenuItem hiddenBookmarkNext = new JMenuItem("");
    hiddenBookmarkNext.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_0, MiscUtils.MENU_MASK));
    hiddenBookmarkNext.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            if (favoriteSheet != null) {
                favoriteSheet.goToNextBookmark();
            }
        }
    });

    hiddenBar.add(hiddenBookmarkPrev);
    hiddenBar.add(hiddenBookmarkNext);
    this.add(hiddenBar);
}