javax.swing.JMenuBar.setSize()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中javax.swing.JMenuBar.setSize()方法的一些代码示例,展示了JMenuBar.setSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenuBar.setSize()方法的具体详情如下:
包路径:javax.swing.JMenuBar
类名称:JMenuBar
方法名:setSize

JMenuBar.setSize介绍

暂无

代码示例

代码示例来源:origin: net.sf.squirrel-sql.plugins/graph

public void setSize(int width, int height)
{
  super.setSize(0,0);
}

代码示例来源:origin: edu.toronto.cs.savant/savant-core

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(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);
}

代码示例来源:origin: net.sf.squirrel-sql.plugins/graph

/**
 * This removes the system menu
 * @return
 */
protected JMenuBar createSystemMenuBar()
{
  menuBar = new JMenuBar()
  {
   public void setSize(int width, int height)
   {
     super.setSize(0,0);
   }
   public void setBounds(int x, int y, int width, int height)
   {
     super.setBounds(0, 0, 0, 0);
   }
  };
  menuBar.setBorderPainted(false);
  menuBar.setSize(0,0);
  menuBar.setBounds(0,0,0,0);
  return menuBar;
}

相关文章