List of usage examples for javax.swing Box createHorizontalStrut
public static Component createHorizontalStrut(int width)
From source file:xtrememp.XtremeMP.java
protected void createMenuBar() { menuBar = new JMenuBar(); // File Menu/*from w w w. j a va 2 s .c om*/ String fileMenuStr = tr("MainFrame.Menu.File"); fileMenu = new JMenu(fileMenuStr); fileMenu.setMnemonic(fileMenuStr.charAt(0)); openMenuItem = new JMenuItem(tr("MainFrame.Menu.File.OpenFile")); openMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK)); openMenuItem.setIcon(Utilities.FOLDER_ICON); openMenuItem.addActionListener(this); fileMenu.add(openMenuItem); openURLMenuItem = new JMenuItem(tr("MainFrame.Menu.File.OpenURL")); openURLMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_DOWN_MASK)); openURLMenuItem.setIcon(Utilities.FOLDER_REMOTE_ICON); openURLMenuItem.addActionListener(this); fileMenu.add(openURLMenuItem); fileMenu.addSeparator(); openPlaylistMenuItem = new JMenuItem(tr("MainFrame.Menu.File.OpenPlaylist")); openPlaylistMenuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK)); openPlaylistMenuItem.setIcon(Utilities.DOCUMENT_OPEN_ICON); openPlaylistMenuItem.addActionListener(this); fileMenu.add(openPlaylistMenuItem); savePlaylistMenuItem = new JMenuItem(tr("MainFrame.Menu.File.SavePlaylist")); savePlaylistMenuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK)); savePlaylistMenuItem.setIcon(Utilities.DOCUMENT_SAVE_ICON); savePlaylistMenuItem.addActionListener(this); fileMenu.add(savePlaylistMenuItem); fileMenu.addSeparator(); preferencesMenuItem = new JMenuItem(tr("MainFrame.Menu.File.Preferences")); preferencesMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_DOWN_MASK)); preferencesMenuItem.addActionListener(this); fileMenu.add(preferencesMenuItem); fileMenu.addSeparator(); exitMenuItem = new JMenuItem(tr("MainFrame.Menu.File.Exit")); exitMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_DOWN_MASK)); exitMenuItem.addActionListener(this); fileMenu.add(exitMenuItem); menuBar.add(fileMenu); // Player Menu String playerMenuStr = tr("MainFrame.Menu.Player"); playerMenu = new JMenu(playerMenuStr); playerMenu.setMnemonic(playerMenuStr.charAt(0)); playPauseMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Play")); playPauseMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK)); playPauseMenuItem.addActionListener(this); playerMenu.add(playPauseMenuItem); stopMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Stop")); stopMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, InputEvent.CTRL_DOWN_MASK)); // stopMenuItem.setIcon(Utilities.MEDIA_STOP_ICON); stopMenuItem.setEnabled(false); stopMenuItem.addActionListener(this); playerMenu.add(stopMenuItem); previousMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Previous")); previousMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_DOWN_MASK)); // previousMenuItem.setIcon(Utilities.MEDIA_PREVIOUS_ICON); previousMenuItem.setEnabled(false); previousMenuItem.addActionListener(this); playerMenu.add(previousMenuItem); nextMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Next")); nextMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_DOWN_MASK)); // nextMenuItem.setIcon(Utilities.MEDIA_NEXT_ICON); nextMenuItem.setEnabled(false); nextMenuItem.addActionListener(this); playerMenu.add(nextMenuItem); playerMenu.addSeparator(); //PlayMode submenu String playModeSubMenuStr = tr("MainFrame.Menu.Player.PlayMode"); playModeSubMenu = new JMenu(playModeSubMenuStr); playModeRepeatNoneMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.Player.PlayMode.RepeatNone")); playModeRepeatNoneMenuItem.setIcon(Utilities.PLAYLIST_REPEAT_NONE_ICON); playModeRepeatNoneMenuItem.addActionListener(this); playModeSubMenu.add(playModeRepeatNoneMenuItem); playModeRepeatOneMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.Player.PlayMode.RepeatOne")); playModeRepeatOneMenuItem.setIcon(Utilities.PLAYLIST_REPEAT_ONE_ICON); playModeRepeatOneMenuItem.addActionListener(this); playModeSubMenu.add(playModeRepeatOneMenuItem); playModeRepeatAllMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.Player.PlayMode.RepeatAll")); playModeRepeatAllMenuItem.setIcon(Utilities.PLAYLIST_REPEAT_ALL_ICON); playModeRepeatAllMenuItem.addActionListener(this); playModeSubMenu.add(playModeRepeatAllMenuItem); playModeShuffleMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.Player.PlayMode.Shuffle")); playModeShuffleMenuItem.setIcon(Utilities.PLAYLIST_SHUFFLE_ICON); playModeShuffleMenuItem.addActionListener(this); playModeSubMenu.add(playModeShuffleMenuItem); ButtonGroup playModeBG = new ButtonGroup(); playModeBG.add(playModeRepeatNoneMenuItem); playModeBG.add(playModeRepeatOneMenuItem); playModeBG.add(playModeRepeatAllMenuItem); playModeBG.add(playModeShuffleMenuItem); playerMenu.add(playModeSubMenu); playerMenu.addSeparator(); randomizePlaylistMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Randomize")); randomizePlaylistMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK)); randomizePlaylistMenuItem.setEnabled(false); randomizePlaylistMenuItem.addActionListener(this); playerMenu.add(randomizePlaylistMenuItem); menuBar.add(playerMenu); // View Menu String viewMenuStr = tr("MainFrame.Menu.View"); viewMenu = new JMenu(viewMenuStr); viewMenu.setMnemonic(viewMenuStr.charAt(0)); playlistManagerMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.View.PlaylistManager")); playlistManagerMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.CTRL_DOWN_MASK)); playlistManagerMenuItem.addActionListener(this); viewMenu.add(playlistManagerMenuItem); visualizationMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.View.Visualizations")); visualizationMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_K, InputEvent.CTRL_DOWN_MASK)); visualizationMenuItem.addActionListener(this); viewMenu.add(visualizationMenuItem); ButtonGroup viewBG = new ButtonGroup(); viewBG.add(playlistManagerMenuItem); viewBG.add(visualizationMenuItem); menuBar.add(viewMenu); // Help menu String helpMenuStr = tr("MainFrame.Menu.Help"); helpMenu = new JMenu(helpMenuStr); helpMenu.setMnemonic(helpMenuStr.charAt(0)); updateMenuItem = new JMenuItem(tr("MainFrame.Menu.Help.CheckForUpdates")); updateMenuItem.addActionListener(this); helpMenu.add(updateMenuItem); helpMenu.addSeparator(); aboutMenuItem = new JMenuItem(tr("MainFrame.Menu.Help.About")); aboutMenuItem.addActionListener(this); helpMenu.add(aboutMenuItem); menuBar.add(helpMenu); menuBar.add(Box.createHorizontalGlue()); busyLabel = new BusyLabel(new Dimension(20, 20)); menuBar.add(busyLabel); menuBar.add(Box.createHorizontalStrut(8)); mainFrame.setJMenuBar(menuBar); }