List of usage examples for javax.swing JMenu setMaximumSize
@BeanProperty(description = "The maximum size of the component.") public void setMaximumSize(Dimension maximumSize)
From source file:org.jdal.swing.PageableTable.java
/** * Create the right menu bar//from w w w . j a va2 s . co m */ private void createMenu() { rightMenuBar = new JMenuBar(); rightMenuBar.setLayout(new BoxLayout(rightMenuBar, BoxLayout.PAGE_AXIS)); rightMenuBar.setMargin(new Insets(0, 0, 0, 0)); // Add Visibility menu JMenu menu = new JMenu(); menu.setMargin(new Insets(0, 0, 0, 0)); menu.setIcon(visibilityMenuIcon); menu.setMaximumSize(new Dimension(50, 50)); visibilityBox = new VisibilityBox(columnDescriptors); menu.add(visibilityBox); menu.getPopupMenu().addPopupMenuListener(new VisibilityPopupListener()); JMenuItem okMenuItem = new JMenuItem(new OkVisibilityAction()); JMenuItem cancelMenuItem = new JMenuItem(new CancelVisibilityAction()); menu.addSeparator(); menu.add(okMenuItem); menu.add(cancelMenuItem); rightMenuBar.add(menu); JMenu prefsMenu = new JMenu(); prefsMenu.setMargin(new Insets(0, 0, 0, 0)); prefsMenu.setIcon(userMenuIcon); prefsMenu.setMaximumSize(new Dimension(50, 50)); prefsMenu.add(new JMenuItem(new LoadPreferencesAction(this, messageSource .getMessage("PageableTable.loadPreferences", null, "Load Preferences", Locale.getDefault())))); prefsMenu.add(new JMenuItem(new SavePreferencesAction(this, messageSource .getMessage("PageableTable.savePreferences", null, "Save Preferences", Locale.getDefault())))); rightMenuBar.add(prefsMenu); rightMenuBar.add(Box.createVerticalGlue()); // Add menu bar to right add(rightMenuBar, BorderLayout.EAST); }