javax.swing.JMenu.setPreferredSize()方法的使用及代码示例

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

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

JMenu.setPreferredSize介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

JMenu spacer = new JMenu();

//disable the spacer so that it doesn't behave
//like a menu item
spacer.setEnabled(false);

//Java components are weird. Set all three to
//guarantee that size is used
spacer.setMinimumSize(new Dimension(width, 1));
spacer.setPreferredSize(new Dimension(width, 1));
spacer.setMaximumSize(new Dimension(width, 1));

//add the spacer to your JMenuBar
jMenuBar.add(spacer);

代码示例来源:origin: robward-scisys/sldeditor

/**
 * (non-Javadoc)
 *
 * @see javax.swing.JComponent#getPreferredSize()
 */
@Override
public Dimension getPreferredSize() {
  if (preferredSize == null) {
    Dimension menuD = getItemSize(menu);
    Insets margin = menu.getMargin();
    Dimension retD = new Dimension(menuD.width, margin.top + margin.bottom + menuD.height);
    menu.setPreferredSize(retD);
    preferredSize = retD;
  }
  return preferredSize;
}

代码示例来源:origin: stackoverflow.com

file.setPreferredSize(new Dimension(fileW, fileH));
menu = new JMenuBar();
menu.setPreferredSize(new Dimension(menuL, menuH));

代码示例来源:origin: net.sf.jung/jung-visualization

Icon icon = BasicIconFactory.getMenuArrowIcon();
modeMenu.setIcon(BasicIconFactory.getMenuArrowIcon());
modeMenu.setPreferredSize(new Dimension(icon.getIconWidth()+10, 
    icon.getIconHeight()+10));

代码示例来源:origin: net.sf.jung/jung-visualization

Icon icon = BasicIconFactory.getMenuArrowIcon();
modeMenu.setIcon(BasicIconFactory.getMenuArrowIcon());
modeMenu.setPreferredSize(new Dimension(icon.getIconWidth()+10, 
    icon.getIconHeight()+10));

代码示例来源:origin: jrtom/jung

Icon icon = BasicIconFactory.getMenuArrowIcon();
modeMenu.setIcon(BasicIconFactory.getMenuArrowIcon());
modeMenu.setPreferredSize(new Dimension(icon.getIconWidth() + 10, icon.getIconHeight() + 10));

代码示例来源:origin: jrtom/jung

Icon icon = BasicIconFactory.getMenuArrowIcon();
modeMenu.setIcon(BasicIconFactory.getMenuArrowIcon());
modeMenu.setPreferredSize(new Dimension(icon.getIconWidth() + 10, icon.getIconHeight() + 10));

代码示例来源:origin: jrtom/jung

Icon icon = BasicIconFactory.getMenuArrowIcon();
modeMenu.setIcon(BasicIconFactory.getMenuArrowIcon());
modeMenu.setPreferredSize(new Dimension(icon.getIconWidth() + 10, icon.getIconHeight() + 10));

代码示例来源:origin: net.sf.jung/jung-visualization

Icon icon = BasicIconFactory.getMenuArrowIcon();
modeMenu.setIcon(BasicIconFactory.getMenuArrowIcon());
modeMenu.setPreferredSize(new Dimension(icon.getIconWidth()+10, 
    icon.getIconHeight()+10));

相关文章