List of usage examples for javax.swing JMenuItem getMaximumSize
@Transient
public Dimension getMaximumSize()
null
value just returns it. From source file:com.haulmont.cuba.desktop.sys.MenuBuilder.java
private void createMenuBarItem(JMenuBar menuBar, MenuItem item) { String caption = menuConfig.getItemCaption(item.getId()); if (!item.getChildren().isEmpty() || item.isMenu()) { final JMenu jMenu = new JMenu(caption); jMenu.addMenuListener(new MenuListener() { @Override// ww w .j a va 2s .c om public void menuSelected(MenuEvent e) { jMenu.requestFocus(); } @Override public void menuDeselected(MenuEvent e) { } @Override public void menuCanceled(MenuEvent e) { } }); jMenu.setName(item.getId()); menuBar.add(jMenu); createSubMenu(jMenu, item); } else { JMenuItem jMenuItem = new JMenuItem(caption); jMenuItem.setName(item.getId()); //todo remove hardcoded border jMenuItem.setBorder(BorderFactory.createEmptyBorder(1, 4, 2, 4)); assignShortcut(jMenuItem, item); jMenuItem.setMaximumSize( new Dimension(jMenuItem.getPreferredSize().width, jMenuItem.getMaximumSize().height)); assignCommand(jMenuItem, item); menuBar.add(jMenuItem); } }