Example usage for javax.swing JMenuBar setSize

List of usage examples for javax.swing JMenuBar setSize

Introduction

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

Prototype

public void setSize(Dimension d) 

Source Link

Document

Resizes this component so that it has width d.width and height d.height .

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(/*from w w  w.ja  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);
}