示例#1
0
  private void addNotificationSettings(final JMenu parentMenu) {
    final JMenu notificationMenu = new JMenu();
    notificationMenu.setMnemonic(KeyEvent.VK_U);
    notificationMenu.setText("User Notifications");
    final JCheckBoxMenuItem showEndOfTurnReport = new JCheckBoxMenuItem("Show End of Turn Report");
    showEndOfTurnReport.setMnemonic(KeyEvent.VK_R);
    final JCheckBoxMenuItem showTriggeredNotifications =
        new JCheckBoxMenuItem("Show Triggered Notifications");
    showTriggeredNotifications.setMnemonic(KeyEvent.VK_T);
    final JCheckBoxMenuItem showTriggerChanceSuccessful =
        new JCheckBoxMenuItem("Show Trigger/Condition Chance Roll Successful");
    showTriggerChanceSuccessful.setMnemonic(KeyEvent.VK_S);
    final JCheckBoxMenuItem showTriggerChanceFailure =
        new JCheckBoxMenuItem("Show Trigger/Condition Chance Roll Failure");
    showTriggerChanceFailure.setMnemonic(KeyEvent.VK_F);
    notificationMenu.addMenuListener(
        new MenuListener() {
          @Override
          public void menuSelected(final MenuEvent e) {
            showEndOfTurnReport.setSelected(iuiContext.getShowEndOfTurnReport());
            showTriggeredNotifications.setSelected(iuiContext.getShowTriggeredNotifications());
            showTriggerChanceSuccessful.setSelected(iuiContext.getShowTriggerChanceSuccessful());
            showTriggerChanceFailure.setSelected(iuiContext.getShowTriggerChanceFailure());
          }

          @Override
          public void menuDeselected(final MenuEvent e) {}

          @Override
          public void menuCanceled(final MenuEvent e) {}
        });
    showEndOfTurnReport.addActionListener(
        e -> iuiContext.setShowEndOfTurnReport(showEndOfTurnReport.isSelected()));
    showTriggeredNotifications.addActionListener(
        e -> iuiContext.setShowTriggeredNotifications(showTriggeredNotifications.isSelected()));
    showTriggerChanceSuccessful.addActionListener(
        e -> iuiContext.setShowTriggerChanceSuccessful(showTriggerChanceSuccessful.isSelected()));
    showTriggerChanceFailure.addActionListener(
        e -> iuiContext.setShowTriggerChanceFailure(showTriggerChanceFailure.isSelected()));
    notificationMenu.add(showEndOfTurnReport);
    notificationMenu.add(showTriggeredNotifications);
    notificationMenu.add(showTriggerChanceSuccessful);
    notificationMenu.add(showTriggerChanceFailure);
    parentMenu.add(notificationMenu);
  }
示例#2
0
  public static JCheckBoxMenuItem createMenuItem2(Action a, char m, int key, HotKey hotKey) {
    JCheckBoxMenuItem res = new JCheckBoxMenuItem(a);
    res.setMnemonic(m);

    int mask = getMask(hotKey);

    if (key != 0) res.setAccelerator(KeyStroke.getKeyStroke(key, mask));

    return res;
  }
示例#3
0
  private void generateMenus() {

    _menuBar = new JMenuBar();

    JMenu menuFile = new JMenu("File");
    JMenu menuGame = new JMenu("Game");
    JMenu menuHelp = new JMenu("Help");

    menuFile.setMnemonic('f');
    menuGame.setMnemonic('g');
    menuHelp.setMnemonic('h');

    JMenuItem menuFileExit = new JMenuItem("Exit", 'x');
    JMenuItem menuFileNew = new JMenuItem("New", 'n');

    _menuGameGo = new JMenuItem("Go", 'g');
    _menuGamePause = new JMenuItem("Pause", 'p');
    _menuGamePause.setEnabled(false);

    JCheckBoxMenuItem menuGameZoomToggle = new JCheckBoxMenuItem("Zoom 2X", false);
    menuGameZoomToggle.setMnemonic('z');

    JMenuItem menuGameOptions = new JMenuItem("Options...", 'o');

    JMenuItem menuHelpAbout = new JMenuItem("About", 'a');

    menuFileExit.addActionListener(this);
    menuFileNew.addActionListener(this);

    _menuGameGo.addActionListener(this);
    _menuGamePause.addActionListener(this);
    menuGameZoomToggle.addActionListener(this);
    menuGameOptions.addActionListener(this);

    menuHelpAbout.addActionListener(this);

    menuFile.add(menuFileNew);
    menuFile.add(menuFileExit);

    menuGame.add(_menuGameGo);
    menuGame.add(_menuGamePause);
    menuGame.add(menuGameZoomToggle);
    menuGame.add(menuGameOptions);

    menuHelp.add(menuHelpAbout);

    _menuBar.add(menuFile);
    _menuBar.add(menuGame);
    _menuBar.add(menuHelp);

    setJMenuBar(_menuBar);
  }
示例#4
0
  /** Creates the option menu. */
  private void createOptionMenu() {
    final JMenu optionMenu = new JMenu("Options");
    optionMenu.setMnemonic(KeyEvent.VK_O);

    final JCheckBoxMenuItem optionGrid = new JCheckBoxMenuItem("Grid");
    optionGrid.setMnemonic(KeyEvent.VK_G);
    optionMenu.add(optionGrid);
    optionGrid.addActionListener(new GridListener());

    final JMenu optionThicknessMenu = new JMenu("Thickness");
    optionThicknessMenu.setMnemonic(KeyEvent.VK_T);

    final JSlider thickSlider = new JSlider(SwingConstants.HORIZONTAL, 0, 20, 1);
    thickSlider.setMajorTickSpacing(DEFAULT_MAJOR_TICK);
    thickSlider.setMinorTickSpacing(1);
    thickSlider.setPaintLabels(true);
    thickSlider.setPaintTicks(true);
    thickSlider.addChangeListener(new ThicknessChangeListener());

    optionThicknessMenu.add(thickSlider);
    optionMenu.add(optionThicknessMenu);
    myMenuBar.add(optionMenu);
  }
示例#5
0
  public JMenuBar createMenuBar() {
    JMenuBar menuBar;
    JMenu menu, submenu;
    JMenuItem menuItem;
    JRadioButtonMenuItem rbMenuItem;
    JCheckBoxMenuItem cbMenuItem;

    // Create the menu bar.
    menuBar = new JMenuBar();

    // Build the first menu.
    menu = new JMenu("A Menu");
    menu.setMnemonic(KeyEvent.VK_A);
    menu.getAccessibleContext()
        .setAccessibleDescription("The only menu in this program that has menu items");
    menuBar.add(menu);

    // a group of JMenuItems
    menuItem = new JMenuItem("A text-only menu item", KeyEvent.VK_T);
    // menuItem.setMnemonic(KeyEvent.VK_T); //used constructor instead
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("This doesn't really do anything");
    menuItem.addActionListener(this);
    menu.add(menuItem);

    ImageIcon icon = createImageIcon("images/middle.gif");
    menuItem = new JMenuItem("Both text and icon", icon);
    menuItem.setMnemonic(KeyEvent.VK_B);
    menuItem.addActionListener(this);
    menu.add(menuItem);

    menuItem = new JMenuItem(icon);
    menuItem.setMnemonic(KeyEvent.VK_D);
    menuItem.addActionListener(this);
    menu.add(menuItem);

    // a group of radio button menu items
    menu.addSeparator();
    ButtonGroup group = new ButtonGroup();

    rbMenuItem = new JRadioButtonMenuItem("A radio button menu item");
    rbMenuItem.setSelected(true);
    rbMenuItem.setMnemonic(KeyEvent.VK_R);
    group.add(rbMenuItem);
    rbMenuItem.addActionListener(this);
    menu.add(rbMenuItem);

    rbMenuItem = new JRadioButtonMenuItem("Another one");
    rbMenuItem.setMnemonic(KeyEvent.VK_O);
    group.add(rbMenuItem);
    rbMenuItem.addActionListener(this);
    menu.add(rbMenuItem);

    // a group of check box menu items
    menu.addSeparator();
    cbMenuItem = new JCheckBoxMenuItem("A check box menu item");
    cbMenuItem.setMnemonic(KeyEvent.VK_C);
    cbMenuItem.addItemListener(this);
    menu.add(cbMenuItem);

    cbMenuItem = new JCheckBoxMenuItem("Another one");
    cbMenuItem.setMnemonic(KeyEvent.VK_H);
    cbMenuItem.addItemListener(this);
    menu.add(cbMenuItem);

    // a submenu
    menu.addSeparator();
    submenu = new JMenu("A submenu");
    submenu.setMnemonic(KeyEvent.VK_S);

    menuItem = new JMenuItem("An item in the submenu");
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, ActionEvent.ALT_MASK));
    menuItem.addActionListener(this);
    submenu.add(menuItem);

    menuItem = new JMenuItem("Another item");
    menuItem.addActionListener(this);
    submenu.add(menuItem);
    menu.add(submenu);

    // Build second menu in the menu bar.
    menu = new JMenu("Another Menu");
    menu.setMnemonic(KeyEvent.VK_N);
    menu.getAccessibleContext().setAccessibleDescription("This menu does nothing");
    menuBar.add(menu);

    return menuBar;
  }
示例#6
0
  // Method builds menu components.
  private JMenuBar buildMenu() {
    // Add menus to the menu bar.
    menuBar.add(file);
    menuBar.add(comm);
    menuBar.add(data);
    menuBar.add(help);

    // Set mnemonics for menu selections.
    file.setMnemonic('F');
    comm.setMnemonic('C');
    data.setMnemonic('D');
    help.setMnemonic('H');

    // Menu items for file menu.
    file.add(menuItemNew);
    file.addSeparator();
    file.add(menuItemOpen);
    file.add(menuItemClose);
    file.addSeparator();
    file.add(menuItemSave);
    file.add(menuItemSaveAs);
    file.addSeparator();
    file.add(menuItemExit);

    // Menu items for comm menu.
    comm.add(menuItemSend);
    comm.add(menuItemReceive);

    // Menu items for comm menu.
    data.add(menuItemConnect);
    data.add(menuItemSubmit);

    // Set mnemonics for menu item selections for file menu.
    menuItemNew.setMnemonic('N');
    menuItemOpen.setMnemonic('O');
    menuItemClose.setMnemonic('C');
    menuItemSave.setMnemonic('S');
    menuItemSaveAs.setMnemonic('A');
    menuItemExit.setMnemonic('X');

    // Set mnemonics for comm item selections for file menu.
    menuItemSend.setMnemonic('S');
    menuItemReceive.setMnemonic('R');

    // Set mnemonics for data item selections for file menu.
    menuItemConnect.setMnemonic('C');
    menuItemSubmit.setMnemonic('R');

    // Menu items to help menu.
    help.add(menuCheckBoxItemDebug);
    help.addSeparator();
    help.add(menuItemHelp);

    // Set mnemonics for menu item selections for edit menu.
    menuCheckBoxItemDebug.setMnemonic('D');
    menuItemHelp.setMnemonic('A');

    // Build menu action listeners.
    buildMenuActionListeners();

    // Set the menu bar in the frame and return menu bar.
    setJMenuBar(menuBar);

    // Return JMenuBar
    return menuBar;
  } // End of buildMenu() method.
示例#7
0
  /** Creates the EditorLite object and displays the GUI with an empty editor pane. */
  public EditorLite() {
    /* Scrollable Text Panes */
    // create some text areas
    // these are dimensionless to let the layout handle it
    editor = new JTextArea();
    editor.setLineWrap(true);
    editor.setWrapStyleWord(true);
    editor.addKeyListener(this);
    side = new JTextArea();
    side.setLineWrap(true);
    side.setEditable(false);

    // create the scroll panes (to house the text areas)
    editorPane = new JScrollPane(editor);
    sidePane = new JScrollPane(side);

    centerPanel = new JPanel(new GridLayout(1, 2));
    centerPanel.add(editorPane);
    centerPanel.add(sidePane);

    /* Button Panel */
    // create the buttonPanel
    buttonPanel = new JPanel(new FlowLayout());

    // create the buttons
    fileChooserButton = new JButton("Open File");
    sideButton = new JButton("Copy to Side Pane");

    // add action listeners to the buttons
    fileChooserButton.addActionListener(this);
    sideButton.addActionListener(this);

    // add the buttons to the buttonPanel
    buttonPanel.add(fileChooserButton);
    buttonPanel.add(sideButton);

    /* Menu Bar */
    // create a menu bar
    menuBar = new JMenuBar();

    // create menus to add to the menu bar
    // also setup mnemonics for keyboard access
    fileMenu = new JMenu("File");
    editMenu = new JMenu("Edit");
    formatMenu = new JMenu("Format");
    viewMenu = new JMenu("View");
    helpMenu = new JMenu("Help");

    fileMenu.setMnemonic(KeyEvent.VK_F);
    editMenu.setMnemonic(KeyEvent.VK_E);
    formatMenu.setMnemonic(KeyEvent.VK_O);
    viewMenu.setMnemonic(KeyEvent.VK_V);
    helpMenu.setMnemonic(KeyEvent.VK_H);

    fileMenu.setDisplayedMnemonicIndex(0);
    editMenu.setDisplayedMnemonicIndex(0);
    formatMenu.setDisplayedMnemonicIndex(1);
    viewMenu.setDisplayedMnemonicIndex(0);
    helpMenu.setDisplayedMnemonicIndex(0);

    // create menu items to add to the menus
    // also setup mnemonics for keyboard access
    // note: \u2026 is a unicode ellipsis (ie, '...')
    newFile = new JMenuItem("New", KeyEvent.VK_N);
    open = new JMenuItem("Open\u2026", KeyEvent.VK_O);
    save = new JMenuItem("Save", KeyEvent.VK_S);
    saveAs = new JMenuItem("Save As\u2026", KeyEvent.VK_A);
    close = new JMenuItem("Exit", KeyEvent.VK_X);
    newFile.setDisplayedMnemonicIndex(0);
    open.setDisplayedMnemonicIndex(0);
    save.setDisplayedMnemonicIndex(0);
    saveAs.setDisplayedMnemonicIndex(5);
    close.setDisplayedMnemonicIndex(1);
    newFile.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK));
    open.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));
    save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
    // disable the save JMenuItem by default
    save.setEnabled(false);

    cut = new JMenuItem("Cut", KeyEvent.VK_T);
    copy = new JMenuItem("Copy", KeyEvent.VK_C);
    paste = new JMenuItem("Paste", KeyEvent.VK_P);
    deleteSelected = new JMenuItem("Delete", KeyEvent.VK_L);
    cut.setDisplayedMnemonicIndex(2);
    copy.setDisplayedMnemonicIndex(0);
    paste.setDisplayedMnemonicIndex(0);
    deleteSelected.setDisplayedMnemonicIndex(2);
    cut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK));
    copy.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK));
    paste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK));
    deleteSelected.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));

    wordWrap = new JCheckBoxMenuItem("Word Wrap", true);
    wordWrap.setMnemonic(KeyEvent.VK_W);
    wordWrap.setDisplayedMnemonicIndex(7);

    toggleSide = new JCheckBoxMenuItem("Side Pane", true);
    toggleSide.setMnemonic(KeyEvent.VK_S);
    toggleSide.setDisplayedMnemonicIndex(7);

    about = new JMenuItem("About " + programName, KeyEvent.VK_A);
    about.setDisplayedMnemonicIndex(0);

    // add action listeners to the menu items
    newFile.addActionListener(this);
    open.addActionListener(this);
    save.addActionListener(this);
    saveAs.addActionListener(this);
    close.addActionListener(this);

    cut.addActionListener(this);
    copy.addActionListener(this);
    paste.addActionListener(this);
    deleteSelected.addActionListener(this);

    wordWrap.addItemListener(this);

    toggleSide.addItemListener(this);

    about.addActionListener(this);

    // add the menu items to the menus
    fileMenu.add(newFile);
    fileMenu.add(open);
    fileMenu.add(save);
    fileMenu.add(saveAs);
    fileMenu.add(close);

    editMenu.add(cut);
    editMenu.add(copy);
    editMenu.add(paste);
    editMenu.add(deleteSelected);

    formatMenu.add(wordWrap);

    viewMenu.add(toggleSide);

    helpMenu.add(about);

    // add the menus to the menu bar
    menuBar.add(fileMenu);
    menuBar.add(editMenu);
    menuBar.add(formatMenu);
    menuBar.add(viewMenu);
    menuBar.add(helpMenu);

    /* Main Frame */
    // initialize
    mainFrame = new JFrame("EditorLite");

    // add the listener for windowClosing event
    mainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    mainFrame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent winEvt) {
            if (isUnsavedFile()) {
              int choice = displayUnsavedWarning();
              if (choice == JOptionPane.YES_OPTION) {
                System.exit(0);
              }
            } else {
              System.exit(0);
            }
          }
        });

    // set up the layout
    mainFrame.setJMenuBar(menuBar);
    mainFrame.add(centerPanel, BorderLayout.CENTER);
    mainFrame.add(buttonPanel, BorderLayout.SOUTH);

    // pack and set a reasonable start size
    mainFrame.pack();
    mainFrame.setSize(600, 400);

    // center the window on the screen
    // basically, it gets the width of the screen, subtracts the width of the frame,
    // and then divides by 2 for the x coordinate
    int xCoord =
        (Toolkit.getDefaultToolkit().getScreenSize().width - mainFrame.getSize().width) / 2;
    // similarly, it gets the height of the screen, subtracts the height of the frame,
    // and then divides by 2 for the y coordinate
    int yCoord =
        (Toolkit.getDefaultToolkit().getScreenSize().height - mainFrame.getSize().height) / 2;
    mainFrame.setLocation(xCoord, yCoord);

    // finally, make it visible
    mainFrame.setVisible(true);
  }
示例#8
0
  /** Build the widget structure of the main window */
  private void createFrame() {

    // Set up the actions table for the whole application
    Toolkit t = Toolkit.getDefaultToolkit();
    Dimension d = t.getScreenSize();

    int width = DEFAULT_WIDTH;
    int height = d.height * 3 / 4;

    top = new JFrame();
    top.setIconImage(
        t.getImage(this.getClass().getResource(rb.getString("frame.jWinDiff.iconImage"))));
    top.setTitle(rb.getString("frame.title.scanning"));
    top.setSize(width, height);

    JPanel base = new JPanel();
    base.setLayout(new BorderLayout());
    top.getContentPane().add(base);

    pictView = new PicturePanel();
    pictView.setOpaque(true);
    pictView.setBackground(Color.white);
    base.add(pictView, BorderLayout.WEST);

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.setOpaque(true);
    //      panel.setBackground(Color.cyan);
    base.add(panel, BorderLayout.NORTH);

    mainView = new JList();
    mainView.setFont(new Font(rb.getString("panel.jWinDiff.font.name"), Font.PLAIN, 12));

    sp = new JScrollPane();
    sp.setViewportView(mainView);
    base.add(sp);

    // Now create each of the menus

    JMenuBar menuBar = new JMenuBar();

    // file
    JMenu menu = new JMenu();
    menu.setText(rb.getString("menu.file.text"));
    menu.setMnemonic(KeyEvent.VK_F);

    compareTargetsMenuItem = new JMenuItem();
    compareTargetsMenuItem.setText(rb.getString("menuItem.compareTargets.text"));
    compareTargetsMenuItem.setMnemonic(KeyEvent.VK_T);
    menu.add(compareTargetsMenuItem);

    menu.addSeparator();

    abortMenuItem = new JMenuItem();
    abortMenuItem.setText(rb.getString("menuItem.abort.text"));
    abortMenuItem.setMnemonic(KeyEvent.VK_A);
    abortMenuItem.setEnabled(false);
    menu.add(abortMenuItem);

    menu.addSeparator();

    saveFilelistMenuItem = new JMenuItem();
    saveFilelistMenuItem.setText(rb.getString("menuItem.saveFileList.text"));
    saveFilelistMenuItem.setMnemonic(KeyEvent.VK_S);
    menu.add(saveFilelistMenuItem);

    JMenuItem menuItem = new JMenuItem();
    menuItem.setText(rb.getString("menuItem.copyFiles.text"));
    menuItem.setMnemonic(KeyEvent.VK_C);
    menuItem.setEnabled(false);
    menu.add(menuItem);

    menuItem = new JMenuItem();
    menuItem.setText(rb.getString("menuItem.print.text"));
    menuItem.setMnemonic(KeyEvent.VK_P);
    menuItem.setEnabled(false);
    menu.add(menuItem);

    exitMenuItem = new JMenuItem();
    exitMenuItem.setText(rb.getString("menuItem.exit.text"));
    exitMenuItem.setMnemonic(KeyEvent.VK_X);
    menu.add(exitMenuItem);

    menuBar.add(menu);

    // edit
    menu = new JMenu();
    menu.setText(rb.getString("menu.edit.text"));
    menu.setMnemonic(KeyEvent.VK_E);

    editLeftMenuItem = new JMenuItem();
    editLeftMenuItem.setText(rb.getString("menuItem.editLeftFile.text"));
    editLeftMenuItem.setMnemonic(KeyEvent.VK_L);
    menu.add(editLeftMenuItem);

    editRightMenuItem = new JMenuItem();
    editRightMenuItem.setText(rb.getString("menuItem.editRightFile.text"));
    editRightMenuItem.setMnemonic(KeyEvent.VK_R);
    menu.add(editRightMenuItem);

    menuItem = new JMenuItem();
    menuItem.setText(rb.getString("menuItem.editCompositeFile.text"));
    menuItem.setMnemonic(KeyEvent.VK_C);
    menuItem.setEnabled(false);
    menu.add(menuItem);

    menu.addSeparator();

    setEditorMenuItem = new JMenuItem();
    setEditorMenuItem.setText(rb.getString("menuItem.setEditor.text"));
    setEditorMenuItem.setMnemonic(KeyEvent.VK_E);
    menu.add(setEditorMenuItem);

    menuBar.add(menu);

    // view
    ButtonGroup bg = new ButtonGroup();

    menu = new JMenu(rb.getString("menu.view.text"));
    menu.setMnemonic(KeyEvent.VK_V);

    viewOutline = new JCheckBoxMenuItem();
    viewOutline.setText(rb.getString("menuItem.outline.text"));
    viewOutline.setMnemonic(KeyEvent.VK_O);
    menu.add(viewOutline);
    bg.add(viewOutline);

    viewExpand = new JCheckBoxMenuItem();
    viewExpand.setText(rb.getString("menuItem.expand.text"));
    viewExpand.setMnemonic(KeyEvent.VK_E);
    menu.add(viewExpand);
    bg.add(viewExpand);

    menu.addSeparator();

    menuItem = new JCheckBoxMenuItem();
    menuItem.setText(rb.getString("menuItem.picture.text"));
    //      menuItem.setMnemonic(KeyEvent.VK_P); // M+p
    menuItem.setEnabled(false);
    menu.add(menuItem);

    menu.addSeparator();

    prevMenuItem = new JMenuItem();
    prevMenuItem.setText(rb.getString("menuItem.previousChange.text"));
    prevMenuItem.setMnemonic(KeyEvent.VK_P); // F7
    menu.add(prevMenuItem);

    nextMenuItem = new JMenuItem();
    nextMenuItem.setText(rb.getString("menuItem.nextChange.text"));
    nextMenuItem.setMnemonic(KeyEvent.VK_N); // F8
    menu.add(nextMenuItem);

    menu.addSeparator();

    rescanMenuItem = new JMenuItem();
    rescanMenuItem.setText(rb.getString("menuItem.rescanSelectedFile.text"));
    rescanMenuItem.setMnemonic(KeyEvent.VK_R);
    menu.add(rescanMenuItem);

    menuBar.add(menu);

    // expand
    menu = new JMenu(rb.getString("menu.expand.text"));
    menu.setMnemonic(KeyEvent.VK_X);

    bg = new ButtonGroup();

    showLeftOnly = new JCheckBoxMenuItem();
    showLeftOnly.setText(rb.getString("menuItem.leftFileOnly.text"));
    showLeftOnly.setMnemonic(KeyEvent.VK_F); // M+l
    showLeftOnly.setActionCommand(ShowExpandMode.left.name());
    menu.add(showLeftOnly);
    bg.add(showLeftOnly);

    showRightOnly = new JCheckBoxMenuItem();
    showRightOnly.setText(rb.getString("menuItem.rightFileOnly.text"));
    showRightOnly.setMnemonic(KeyEvent.VK_H); // M-r
    showRightOnly.setActionCommand(ShowExpandMode.right.name());
    menu.add(showRightOnly);
    bg.add(showRightOnly);

    showBoth = new JCheckBoxMenuItem();
    showBoth.setText(rb.getString("menuItem.bothFiles.text"));
    showBoth.setMnemonic(KeyEvent.VK_O); // M-b
    showBoth.setActionCommand(ShowExpandMode.both.name());
    showBoth.setSelected(true);
    menu.add(showBoth);
    bg.add(showBoth);

    menu.addSeparator();

    bg = new ButtonGroup();

    showLeftNums = new JCheckBoxMenuItem();
    showLeftNums.setText(rb.getString("menuItem.leftLineNumbers.text"));
    showLeftNums.setMnemonic(KeyEvent.VK_L);
    showLeftNums.setActionCommand(ShowNumMode.left.name());
    menu.add(showLeftNums);
    bg.add(showLeftNums);

    showRightNums = new JCheckBoxMenuItem();
    showRightNums.setText(rb.getString("menuItem.rightLineNumbers.text"));
    showRightNums.setMnemonic(KeyEvent.VK_R);
    showRightNums.setActionCommand(ShowNumMode.right.name());
    menu.add(showRightNums);
    bg.add(showRightNums);

    hideNums = new JCheckBoxMenuItem();
    hideNums.setText(rb.getString("menuItem.noLineNumbers.text"));
    hideNums.setMnemonic(KeyEvent.VK_N);
    hideNums.setActionCommand(ShowNumMode.none.name());
    hideNums.setSelected(true);
    menu.add(hideNums);
    bg.add(hideNums);

    menuBar.add(menu);

    // opts
    menu = new JMenu(rb.getString("menu.opts.text"));
    menu.setMnemonic(KeyEvent.VK_O);

    ignoreBlanks = new JCheckBoxMenuItem();
    ignoreBlanks.setText(rb.getString("menuItem.ignoreBlanks.text"));
    ignoreBlanks.setMnemonic(KeyEvent.VK_B);
    ignoreBlanks.setSelected(true);
    menu.add(ignoreBlanks);

    menu.addSeparator();

    menuItem = new JCheckBoxMenuItem(rb.getString("menuItem.monoColours.text"));
    menuItem.setMnemonic(KeyEvent.VK_M);
    menuItem.setEnabled(false);
    menu.add(menuItem);

    menu.addSeparator();

    showIdentical = new JCheckBoxMenuItem();
    showIdentical.setText(rb.getString("menuItem.showIdenticalFiles.text"));
    showIdentical.setMnemonic(KeyEvent.VK_I);
    showIdentical.setSelected(true);
    menu.add(showIdentical);

    showLeft = new JCheckBoxMenuItem();
    showLeft.setText(rb.getString("menuItem.showLeftOnlyFiles.text"));
    showLeft.setMnemonic(KeyEvent.VK_L);
    showLeft.setSelected(true);
    menu.add(showLeft);

    showRight = new JCheckBoxMenuItem();
    showRight.setText(rb.getString("menuItem.showRightOnlyFiles.text"));
    showRight.setMnemonic(KeyEvent.VK_R);
    showRight.setSelected(true);
    menu.add(showRight);

    showDifferent = new JCheckBoxMenuItem();
    showDifferent.setText(rb.getString("menuItem.showDifferentFiles.text"));
    showDifferent.setMnemonic(KeyEvent.VK_D);
    showDifferent.setSelected(true);
    menu.add(showDifferent);

    menuBar.add(menu);

    // mark
    menu = new JMenu();
    menu.setText(rb.getString("menu.mark.text"));
    menu.setMnemonic(KeyEvent.VK_K);

    markFileMenuItem = new JMenuItem();
    markFileMenuItem.setText(rb.getString("menuItem.markFile.text"));
    markFileMenuItem.setMnemonic(KeyEvent.VK_M); // M+m
    menu.add(markFileMenuItem);

    markPatternMenuItem = new JMenuItem();
    markPatternMenuItem.setText(rb.getString("menuItem.markPattern.text"));
    markPatternMenuItem.setMnemonic(KeyEvent.VK_P);
    menu.add(markPatternMenuItem);

    hideMarked = new JCheckBoxMenuItem();
    hideMarked.setText(rb.getString("menuItem.hideMarkedFiles.text"));
    hideMarked.setMnemonic(KeyEvent.VK_H);
    menu.add(hideMarked);

    toggleMarkedMenuItem = new JMenuItem();
    toggleMarkedMenuItem.setText(rb.getString("menuItem.toggleMarkedState.text"));
    toggleMarkedMenuItem.setMnemonic(KeyEvent.VK_T);
    menu.add(toggleMarkedMenuItem);

    menuBar.add(menu);

    // help
    menu = new JMenu();
    menu.setText(rb.getString("menu.help.text"));
    menu.setMnemonic(KeyEvent.VK_H);

    menuItem = new JMenuItem();
    menuItem.setText(rb.getString("menuItem.contents.text"));
    menuItem.setMnemonic(KeyEvent.VK_C);
    menuItem.setEnabled(false);
    menu.add(menuItem);

    menu.addSeparator();

    menuItem = new JMenuItem();
    menuItem.setText(rb.getString("menuItem.about.text"));
    menuItem.setMnemonic(KeyEvent.VK_A);
    menuItem.setEnabled(false);
    menu.add(menuItem);

    menuBar.add(menu);

    top.setJMenuBar(menuBar);

    // popup outline menu
    popupOutline = new JPopupMenu();

    markFileMenuItem.setMnemonic(KeyEvent.VK_M);
    popupOutline.add(markFileMenuItem);

    popupOutline.addSeparator();

    nextMenuItem2 = new JMenuItem();
    nextMenuItem2.setText(rb.getString("menuItem.nextChange.text"));
    nextMenuItem2.setMnemonic(KeyEvent.VK_N); // F8
    popupOutline.add(nextMenuItem2);

    prevMenuItem2 = new JMenuItem();
    prevMenuItem2.setText(rb.getString("menuItem.previousChange.text"));
    prevMenuItem2.setMnemonic(KeyEvent.VK_P); // F7
    popupOutline.add(prevMenuItem2);

    expandMenuItem = new JMenuItem();
    expandMenuItem.setText(rb.getString("button.changeMode.text.expand"));
    expandMenuItem.setMnemonic(KeyEvent.VK_E);
    popupOutline.add(expandMenuItem);

    rescanMenuItem2 = new JMenuItem();
    rescanMenuItem2.setText(rb.getString("menuItem.rescanSelectedFile.text"));
    rescanMenuItem2.setMnemonic(KeyEvent.VK_R);
    popupOutline.add(rescanMenuItem2);

    popupOutline.addSeparator();

    editLeftMenuItem2 = new JMenuItem();
    editLeftMenuItem2.setText(rb.getString("menuItem.editLeftFile.text"));
    editLeftMenuItem2.setMnemonic(KeyEvent.VK_L);
    popupOutline.add(editLeftMenuItem2);

    editRightMenuItem2 = new JMenuItem();
    editRightMenuItem2.setText(rb.getString("menuItem.editRightFile.text"));
    editRightMenuItem2.setMnemonic(KeyEvent.VK_R);
    popupOutline.add(editRightMenuItem2);

    menuItem = new JMenuItem();
    menuItem.setText(rb.getString("menuItem.editCompositeFile.text"));
    menuItem.setMnemonic(KeyEvent.VK_C);
    menuItem.setEnabled(false);
    popupOutline.add(menuItem);

    // popup expanded menu
    popupExpanded = new JPopupMenu();

    menuItem = popupExpanded.add(rb.getString("menuItem.showMoveDest.text"));
    menuItem.setMnemonic(KeyEvent.VK_S);
    menuItem.setEnabled(false);

    popupExpanded.addSeparator();

    nextMenuItem3 = new JMenuItem();
    nextMenuItem3.setText(rb.getString("menuItem.nextChange.text"));
    nextMenuItem3.setMnemonic(KeyEvent.VK_N); // F8
    popupExpanded.add(nextMenuItem3);

    prevMenuItem3 = new JMenuItem();
    prevMenuItem3.setText(rb.getString("menuItem.previousChange.text"));
    prevMenuItem3.setMnemonic(KeyEvent.VK_P); // F7
    popupExpanded.add(prevMenuItem3);

    outlineMenuItem = new JMenuItem();
    outlineMenuItem.setText(rb.getString("button.changeMode.text.outline"));
    outlineMenuItem.setMnemonic(KeyEvent.VK_O);
    popupExpanded.add(outlineMenuItem);

    rescanMenuItem3 = new JMenuItem();
    rescanMenuItem3.setText(rb.getString("menuItem.rescanSelectedFile.text"));
    rescanMenuItem3.setMnemonic(KeyEvent.VK_R);
    popupExpanded.add(rescanMenuItem3);

    popupExpanded.addSeparator();

    editLeftMenuItem3 = new JMenuItem();
    editLeftMenuItem3.setText(rb.getString("menuItem.editLeftFile.text"));
    editLeftMenuItem3.setMnemonic(KeyEvent.VK_L);
    popupExpanded.add(editLeftMenuItem3);

    editRightMenuItem3 = new JMenuItem();
    editRightMenuItem3.setText(rb.getString("menuItem.editRightFile.text"));
    editRightMenuItem3.setMnemonic(KeyEvent.VK_R);
    popupExpanded.add(editRightMenuItem3);

    menuItem = new JMenuItem();
    menuItem.setText(rb.getString("menuItem.editCompositeFile.text"));
    menuItem.setMnemonic(KeyEvent.VK_C);
    menuItem.setEnabled(false);
    popupExpanded.add(menuItem);

    // labels
    names = new JLabel();
    names.setForeground(Color.blue);
    panel.add(BorderLayout.WEST, names);

    paths = new JLabel();
    paths.setBorder(new BevelBorder(BevelBorder.LOWERED));
    panel.add(BorderLayout.CENTER, paths);

    // chageMode button
    changeMode = new JButton();
    changeMode.setMnemonic(KeyEvent.VK_D);
    panel.add(BorderLayout.EAST, changeMode);
  }