private void initializeItems() { moveTo = new JMenu(model.getName("SPOT_POPUP_MOVE_ITEM")); add(moveTo); for (TreeNode n : groups) { JMenuItem item = new JMenuItem(n.toString()); item.addActionListener(this); moveTo.add(item); } }
public void actionPerformed(ActionEvent event) { if (event.getSource() == view.exitItem) { System.exit(0); } else if (event.getSource() == view.connectItem) { ConnectionDialog dialog = new ConnectionDialog(model); } else if (event.getSource() == view.disconnectItem) { System.out.println(view.disconnectItem.getText()); } else if (event.getSource() == view.reconnectItem) { System.out.println(view.reconnectItem.getText()); } else if (event.getSource() == view.resetItem) { JOptionPane.showMessageDialog( null, model.getName("RESET_WARNING_MSG"), model.getName("RESET_WARNING_TITLE"), JOptionPane.WARNING_MESSAGE); } else if (event.getSource() == view.perspectiveItem) { System.out.println(view.perspectiveItem.getText()); } else if (event.getSource() == view.sideViewitem) { System.out.println(view.sideViewitem.getText()); } else if (event.getSource() == view.topViewItem) { System.out.println(view.topViewItem.getText()); } else if (event.getSource() == view.showGridItem) { System.out.println(view.showGridItem.getText()); } else if (event.getSource() == view.layoutItem1) { System.out.println(view.layoutItem1.getText()); } else if (event.getSource() == view.layoutItem2) { System.out.println(view.layoutItem2.getText()); } else if (event.getSource() == view.layoutItem3) { System.out.println(view.layoutItem3.getText()); } else if (event.getSource() == view.layoutItem4) { System.out.println(view.layoutItem4.getText()); } else if (event.getSource() == view.settingsItem) { System.out.println(view.settingsItem.getText()); } else if (event.getSource() == view.modeItem1) { System.out.println(view.modeItem1.getText()); } else if (event.getSource() == view.modeItem2) { System.out.println(view.modeItem2.getText()); } else if (event.getSource() == view.helpItem) { System.out.println(view.helpItem.getText()); } else if (event.getSource() == view.aboutItem) { System.out.println(view.aboutItem.getText()); } }
private void createMenus() { fileMenu = new JMenu(model.getName("FILE_MENU_NAME")); actionMenu = new JMenu(model.getName("ACTION_MENU_NAME")); viewMenu = new JMenu(model.getName("VIEW_MENU_NAME")); toolsMenu = new JMenu(model.getName("TOOLS_MENU_NAME")); helpMenu = new JMenu(model.getName("HELP_MENU_NAME")); layoutSubMenu = new JMenu(model.getName("LAYOUT_SUBMENU_NAME")); modeSubMenu = new JMenu(model.getName("MODE_SUBMENU_NAME")); }
private void createMenuItems() { // Regular items openItem = new JMenuItem(model.getName("OPEN_ITEM_NAME")); exitItem = new JMenuItem(model.getName("EXIT_ITEM_NAME")); connectItem = new JMenuItem(model.getName("CONNECT_ITEM_NAME")); disconnectItem = new JMenuItem(model.getName("DISCONNECT_ITEM_NAME")); reconnectItem = new JMenuItem(model.getName("RECONNECT_ITEM_NAME")); resetItem = new JMenuItem(model.getName("RESET_ITEM_NAME")); // Checkboxes perspectiveItem = new JCheckBoxMenuItem(model.getName("PERSPECTIVE_CBOX_NAME")); sideViewitem = new JCheckBoxMenuItem(model.getName("SIDE_VIEW_CBOX_NAME")); topViewItem = new JCheckBoxMenuItem(model.getName("TOP_VIEW_CBOX_NAME")); showGridItem = new JCheckBoxMenuItem(model.getName("SHOW_GRID_CBOX_NAME")); // Radios layoutItem1 = new JRadioButtonMenuItem(model.getName("LAYOUT_RADIO_1_NAME")); layoutItem2 = new JRadioButtonMenuItem(model.getName("LAYOUT_RADIO_2_NAME")); layoutItem3 = new JRadioButtonMenuItem(model.getName("LAYOUT_RADIO_3_NAME")); layoutItem4 = new JRadioButtonMenuItem(model.getName("LAYOUT_RADIO_4_NAME")); // And more regular items settingsItem = new JMenuItem(model.getName("SETTINGS_ITEM_NAME")); modeItem1 = new JMenuItem(model.getName("MODE_ITEM_1_NAME")); modeItem2 = new JMenuItem(model.getName("MODE_ITEM_2_NAME")); helpItem = new JMenuItem(model.getName("HELP_ITEM_NAME")); aboutItem = new JMenuItem(model.getName("ABOUT_ITEM_NAME")); }