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

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

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

JMenuBar.getMinimumSize介绍

暂无

代码示例

代码示例来源: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.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: khuxtable/seaglass

mbd = root.getJMenuBar().getMinimumSize();
if (mbd != null) {
  mbWidth  = mbd.width;

代码示例来源:origin: org.java.net.substance/substance

mbd = root.getJMenuBar().getMinimumSize();
if (mbd != null) {
  mbWidth = mbd.width;

代码示例来源:origin: com.github.insubstantial/substance

mbd = root.getJMenuBar().getMinimumSize();
if (mbd != null) {
  mbWidth = mbd.width;

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

mbd = root.getMenuBar().getMinimumSize();
if (mbd != null)

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf

mbd = root.getJMenuBar().getMinimumSize();
if (mbd != null) {
 mbWidth = mbd.width;

相关文章