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

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

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

JMenuBar.isVisible介绍

暂无

代码示例

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = VISIBLE_JSDOC)
@Override
public boolean getVisible() {
  return super.isVisible();
}

代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf

public int getJMenuBarExtraHeight() {
  JMenuBar jMenuBar = getRootPane().getJMenuBar();
  if (jMenuBar != null && jMenuBar.isVisible())
    return jMenuBar.getHeight();
  return 0;
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

/**
 * Returns the maximum amount of space the layout can use.
 *
 * @param target the Container for which this layout manager
 * is being used
 * @return a Dimension object containing the layout's maximum size
 */
public Dimension maximumLayoutSize(Container target) {
  Dimension rd, mbd;
  Insets i = rootPane.getInsets();
  Container contentPane = rootPane.getContentPane();
  JMenuBar menuBar = rootPane.getJMenuBar();
  if (menuBar != null && menuBar.isVisible()) {
    mbd = menuBar.getMaximumSize();
  } else {
    mbd = new Dimension(0, 0);
  }
  if (contentPane != null && contentPane.isVisible()) {
    rd = contentPane.getMaximumSize();
  } else {
    // This is silly, but should stop an overflow error
    rd = new Dimension(Integer.MAX_VALUE,
        Integer.MAX_VALUE - i.top - i.bottom - mbd.height - 1);
  }
  return new Dimension(Math.min(rd.width, mbd.width) + i.left + i.right,
      rd.height + mbd.height + i.top + i.bottom);
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

/**
 * Returns the minimum amount of space the layout needs.
 *
 * @param parent the Container for which this layout manager
 * is being used
 * @return a Dimension object containing the layout's minimum size
 */
public Dimension minimumLayoutSize(Container parent) {
  Dimension rd, mbd;
  Insets i = rootPane.getInsets();
  Container contentPane = rootPane.getContentPane();
  JMenuBar menuBar = rootPane.getJMenuBar();
  if (contentPane != null && contentPane.isVisible()) {
    rd = contentPane.getMinimumSize();
  } else if (contentPane != null) {
    rd = new Dimension(0, contentPane.getPreferredSize().height);
  } else {
    rd = new Dimension(0,0);
  }
  if (menuBar != null && menuBar.isVisible()) {
    mbd = menuBar.getMinimumSize();
  } else {
    mbd = new Dimension(0, 0);
  }
  return new Dimension(Math.max(rd.width, mbd.width) + i.left + i.right,
      rd.height + mbd.height + i.top + i.bottom);
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

/**
 * Returns the amount of space the layout would like to have.
 *
 * @param parent the Container for which this layout manager
 * is being used
 * @return a Dimension object containing the layout's preferred size
 */
@Override
public Dimension preferredLayoutSize(Container parent) {
  Dimension rd, mbd;
  Insets i = rootPane.getInsets();
  Container contentPane = rootPane.getContentPane();
  JMenuBar menuBar = rootPane.getJMenuBar();
  if (contentPane.isVisible()) {
    rd = contentPane.getPreferredSize();
  } else {
    rd = new Dimension(0, contentPane.getPreferredSize().height);
  }
  if (menuBar != null && menuBar.isVisible()) {
    mbd = menuBar.getPreferredSize();
  } else {
    mbd = new Dimension(0, 0);
  }
  return new Dimension(Math.max(rd.width, mbd.width) + i.left + i.right,
      rd.height + mbd.height + i.top + i.bottom);
}

代码示例来源:origin: org.gephi/desktop-banner

@Override
  public Dimension preferredLayoutSize(Container parent) {
    int contentWidth = 0;
    int menuWidth = 0;
    int height = 0;

    JRootPane rootPane = (JRootPane) parent;
//        hideMenu(rootPane);

    Insets insets = parent.getInsets();
    height += insets.top + insets.bottom;

    Dimension contentSize;
    if (rootPane.getContentPane() != null) {
      contentSize = rootPane.getContentPane().getPreferredSize();
    } else {
      contentSize = rootPane.getSize();
    }
    contentWidth = contentSize.width;
    height += contentSize.height;

    if (rootPane.getJMenuBar() != null && rootPane.getJMenuBar().isVisible()) {
      Dimension menuSize = rootPane.getJMenuBar().getPreferredSize();
      height += menuSize.height;
      menuWidth = menuSize.width;
    }

    return new Dimension(Math.max(contentWidth, menuWidth) + insets.left + insets.right, height);
  }

代码示例来源:origin: org.gephi/desktop-banner

@Override
public Dimension minimumLayoutSize(Container parent) {
  int contentWidth = 0;
  int menuWidth = 0;
  int height = 0;
  Insets insets = parent.getInsets();
  height += insets.top + insets.bottom;
  JRootPane rootPane = (JRootPane) parent;
  Dimension contentSize;
  if (rootPane.getContentPane() != null) {
    contentSize = rootPane.getContentPane().getMinimumSize();
  } else {
    contentSize = rootPane.getSize();
  }
  contentWidth = contentSize.width;
  height += contentSize.height;
  if (rootPane.getJMenuBar() != null && rootPane.getJMenuBar().isVisible()) {
    Dimension menuSize = rootPane.getJMenuBar().getMinimumSize();
    height += menuSize.height;
    menuWidth = menuSize.width;
  }
  return new Dimension(Math.max(contentWidth, menuWidth) + insets.left + insets.right, height);
}

代码示例来源:origin: nl.cloudfarming.client/menu

@Override
public Dimension minimumLayoutSize(Container parent) {
  int contentWidth = 0;
  int menuWidth = 0;
  int height = 0;
  Insets insets = parent.getInsets();
  height += insets.top + insets.bottom;
  JRootPane rootPane = (JRootPane) parent;
  Dimension contentSize;
  if (rootPane.getContentPane() != null) {
    contentSize = rootPane.getContentPane().getMinimumSize();
  } else {
    contentSize = rootPane.getSize();
  }
  contentWidth = contentSize.width;
  height += contentSize.height;
  if (rootPane.getJMenuBar() != null && rootPane.getJMenuBar().isVisible()) {
    Dimension menuSize = rootPane.getJMenuBar().getMinimumSize();
    height += menuSize.height;
    menuWidth = menuSize.width;
  }
  return new Dimension(Math.max(contentWidth, menuWidth) + insets.left + insets.right, height);
}

代码示例来源:origin: nl.cloudfarming.client/menu

@Override
public Dimension preferredLayoutSize(Container parent) {
  int contentWidth = 0;
  int menuWidth = 0;
  int height = 0;
  JRootPane rootPane = (JRootPane) parent;
  hideMenu(rootPane);
  Insets insets = parent.getInsets();
  height += insets.top + insets.bottom;
  Dimension contentSize;
  if (rootPane.getContentPane() != null) {
    contentSize = rootPane.getContentPane().getPreferredSize();
  } else {
    contentSize = rootPane.getSize();
  }
  contentWidth = contentSize.width;
  height += contentSize.height;
  if (rootPane.getJMenuBar() != null && rootPane.getJMenuBar().isVisible()) {
    Dimension menuSize = rootPane.getJMenuBar().getPreferredSize();
    height += menuSize.height;
    menuWidth = menuSize.width;
  }
  return new Dimension(Math.max(contentWidth, menuWidth) + insets.left + insets.right, height);
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

if (menuBar != null && menuBar.isVisible()) {
  Dimension mbd = menuBar.getPreferredSize();
  menuBar.setBounds(0, 0, w, mbd.height);

代码示例来源:origin: org.gephi/desktop-banner

if (rootPane.getJMenuBar() != null && rootPane.getJMenuBar().isVisible()) {
  JMenuBar menu = rootPane.getJMenuBar();
  Dimension size = menu.getPreferredSize();

代码示例来源:origin: nl.cloudfarming.client/menu

if (rootPane.getJMenuBar() != null && rootPane.getJMenuBar().isVisible()) {
  JMenuBar menu = rootPane.getJMenuBar();
  Dimension size = menu.getPreferredSize();

代码示例来源:origin: uk.co.caprica/vlcj

@Override
  public void eventDispatched(AWTEvent event) {
    if (event instanceof KeyEvent) {
      KeyEvent keyEvent = (KeyEvent)event;
      if (keyEvent.getID() == KeyEvent.KEY_PRESSED) {
        if (keyEvent.getKeyCode() == KeyEvent.VK_F12) {
          controlsPanel.setVisible(!controlsPanel.isVisible());
          videoAdjustPanel.setVisible(!videoAdjustPanel.isVisible());
          mainFrame.getJMenuBar().setVisible(!mainFrame.getJMenuBar().isVisible());
          mainFrame.invalidate();
          mainFrame.validate();
        } else if (keyEvent.getKeyCode() == KeyEvent.VK_A) {
          mediaPlayer.audio().setDelay(mediaPlayer.audio().delay() - 50000);
        } else if (keyEvent.getKeyCode() == KeyEvent.VK_S) {
          mediaPlayer.audio().setDelay(mediaPlayer.audio().delay() + 50000);
        } else if (keyEvent.getKeyCode() == KeyEvent.VK_1) {
          mediaPlayer.controls().setTime(60000 * 1);
        } else if (keyEvent.getKeyCode() == KeyEvent.VK_2) {
          mediaPlayer.controls().setTime(60000 * 2);
        } else if (keyEvent.getKeyCode() == KeyEvent.VK_3) {
          mediaPlayer.controls().setTime(60000 * 3);
        }
      }
    }
  }
}, AWTEvent.KEY_EVENT_MASK);

相关文章