Beispiel #1
0
 private void setListeners() {
   // Regular items
   openItem.addActionListener(controller);
   exitItem.addActionListener(controller);
   connectItem.addActionListener(controller);
   disconnectItem.addActionListener(controller);
   reconnectItem.addActionListener(controller);
   resetItem.addActionListener(controller);
   // Checkboxes
   perspectiveItem.addActionListener(controller);
   sideViewitem.addActionListener(controller);
   topViewItem.addActionListener(controller);
   showGridItem.addActionListener(controller);
   // Radios
   layoutItem1.addActionListener(controller);
   layoutItem2.addActionListener(controller);
   layoutItem3.addActionListener(controller);
   layoutItem4.addActionListener(controller);
   // And more regular items
   settingsItem.addActionListener(controller);
   modeItem1.addActionListener(controller);
   modeItem2.addActionListener(controller);
   helpItem.addActionListener(controller);
   aboutItem.addActionListener(controller);
 }
Beispiel #2
0
  @NotNull
  private JPopupMenu createMenu(final Node config) {
    JPopupMenu menu = new JPopupMenu();
    final JCheckBoxMenuItem showRpmItem = new JCheckBoxMenuItem("Show RPM");
    final JCheckBoxMenuItem showCommandsItem = new JCheckBoxMenuItem("Show Commands");
    showRpmItem.setSelected(showRpmPanel);
    ActionListener showCheckboxListener =
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            showRpmPanel = showRpmItem.isSelected();
            showMessagesPanel = showCommandsItem.isSelected();
            config.setProperty(SHOW_RPM, showRpmPanel);
            config.setProperty(SHOW_MESSAGES, showMessagesPanel);
            applyShowFlags();
            // todo: this is not needed if we show/hide RPM panel. TODO: split into two different
            // listeners
            middleSplitPanel.setDividerLocation(0.5);
          }
        };
    showRpmItem.addActionListener(showCheckboxListener);
    showCommandsItem.addActionListener(showCheckboxListener);

    menu.add(showRpmItem);
    showCommandsItem.setSelected(showMessagesPanel);
    menu.add(showCommandsItem);
    menu.add(new JPopupMenu.Separator());
    menu.add(new JPopupMenu("Reset Config"));
    return menu;
  }
Beispiel #3
0
 public void updateMidiInMenuOptions(String[] midiInOptions) {
   midiInMenu.removeAll();
   pageChangeMidiInMenu.removeAll();
   for (int i = 0; i < midiInOptions.length; i++) {
     midiInMenu.remove(getNoInputDevicesEnabledItem());
     pageChangeMidiInMenu.remove(getNoInputDevicesEnabledItem2());
     JCheckBoxMenuItem cbMenuItem = new JCheckBoxMenuItem("MIDI Input: " + midiInOptions[i]);
     JCheckBoxMenuItem cbMenuItem2 = new JCheckBoxMenuItem("MIDI Input: " + midiInOptions[i]);
     cbMenuItem.addActionListener(
         new java.awt.event.ActionListener() {
           public void actionPerformed(java.awt.event.ActionEvent e) {
             String[] pieces = e.getActionCommand().split("MIDI Input: ");
             actionToggleMidiInput(pieces[1]);
           }
         });
     cbMenuItem2.addActionListener(
         new java.awt.event.ActionListener() {
           public void actionPerformed(java.awt.event.ActionEvent e) {
             String[] pieces = e.getActionCommand().split("MIDI Input: ");
             actionTogglePageChangeMidiInput(pieces[1]);
           }
         });
     midiInMenu.add(cbMenuItem);
     pageChangeMidiInMenu.add(cbMenuItem2);
   }
   if (midiInMenu.getItemCount() == 0) {
     midiInMenu.add(getNoInputDevicesEnabledItem());
     pageChangeMidiInMenu.add(getNoInputDevicesEnabledItem2());
   }
 }
  public MapViewPopup() {
    entityInfoMenuItem = new JMenuItem("Entity Info");
    entityInfoMenuItem.addActionListener(this);
    add(entityInfoMenuItem);

    JMenu markerMenu = new JMenu("Marker");
    add(markerMenu);
    createMarkerMenuItem = new JMenuItem("Create");
    createMarkerMenuItem.addActionListener(this);
    markerMenu.add(createMarkerMenuItem);
    removeMarkerMenuItem = new JMenuItem("Remove");
    removeMarkerMenuItem.addActionListener(this);
    markerMenu.add(removeMarkerMenuItem);
    loadMarkersMenuItem = new JMenuItem("Load All");
    loadMarkersMenuItem.addActionListener(this);
    markerMenu.add(loadMarkersMenuItem);
    saveMarkersMenuItem = new JMenuItem("Save All");
    saveMarkersMenuItem.addActionListener(this);
    markerMenu.add(saveMarkersMenuItem);

    clearMenuItem = new JMenuItem("Clear M&T");
    clearMenuItem.addActionListener(this);
    add(clearMenuItem);

    functionsMenuItem = new JMenuItem("Functions");
    functionsMenuItem.addActionListener(this);
    add(functionsMenuItem);

    addSeparator();
    debugMenuItem = new JCheckBoxMenuItem("Debug Mode");
    debugMenuItem.addActionListener(this);
    add(debugMenuItem);
  }
Beispiel #5
0
 private static JMenuItem getMenuItem_ShowTabs() {
   final JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem("Panel Tabs");
   menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_T));
   menuItem.setState(!prefs.getPrefBoolean(FPref.UI_HIDE_GAME_TABS));
   menuItem.addActionListener(getShowTabsAction(menuItem));
   return menuItem;
 }
Beispiel #6
0
  /** @param index */
  private void createPlayerTypeOptions() {
    radioHuman = new FRadioButton("Human");
    radioAi = new FRadioButton("AI");
    radioOpen = new FRadioButton("Open");

    final JPopupMenu menu = new JPopupMenu();
    radioAiUseSimulation = new JCheckBoxMenuItem("Use Simulation");
    menu.add(radioAiUseSimulation);
    radioAiUseSimulation.addActionListener(
        new ActionListener() {
          @Override
          public final void actionPerformed(final ActionEvent e) {
            lobby.firePlayerChangeListener(index);
          }
        });
    radioAi.setComponentPopupMenu(menu);

    radioHuman.addMouseListener(radioMouseAdapter(radioHuman, LobbySlotType.LOCAL));
    radioAi.addMouseListener(radioMouseAdapter(radioAi, LobbySlotType.AI));
    radioOpen.addMouseListener(radioMouseAdapter(radioOpen, LobbySlotType.OPEN));

    final ButtonGroup tempBtnGroup = new ButtonGroup();
    tempBtnGroup.add(radioHuman);
    tempBtnGroup.add(radioAi);
    tempBtnGroup.add(radioOpen);
  }
  /** Initializes the core phone objects. */
  private void initializePhone() {
    // Load Preferences
    loadPreferences();

    if (preferences == null) {
      return;
    }

    guiManager = new GuiManager();
    guiManager.addUserActionListener(this);
    logManager = new LogManagerImpl(this);

    this.getLogManager().setRemoteLogging(true);

    try {
      EventQueue.invokeAndWait(
          new Runnable() {
            @Override
            public void run() {
              registerMenu = new JCheckBoxMenuItem(PhoneRes.getIString("phone.enabled"));
            }
          });
    } catch (Exception e) {
      Log.error(e);
    }

    registerMenu.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            if (getStatus() == SipRegisterStatus.Unregistered
                || getStatus() == SipRegisterStatus.RegistrationFailed) {

              register();
            } else {
              handleUnregisterRequest();
            }
          }
        });

    SIPConfig.setPreferredNetworkAddress(preferences.getPreferredAddress());
    NetworkAddressManager.start();

    try {
      EventQueue.invokeAndWait(
          new Runnable() {
            @Override
            public void run() {
              // Initialize Missed calls
              missedCalls = new MissedCalls();
            }
          });
    } catch (Exception e) {
      Log.error(e);
    }

    final JMenu actionsMenu =
        SparkManager.getMainWindow().getMenuByName(Res.getString("menuitem.actions"));
    actionsMenu.add(registerMenu);
  }
Beispiel #8
0
 public BaseTranslate() {
   menuItem = new JCheckBoxMenuItem();
   Mnemonics.setLocalizedText(menuItem, getName());
   menuItem.addActionListener(this);
   enabled = Preferences.isPreference(getPreferenceName());
   menuItem.setState(enabled);
   Core.getMainWindow().getMainMenu().getMachineTranslationMenu().add(menuItem);
 }
    public DescPropPopup() {
      super("Descriptor Properties");
      v = new JCheckBoxMenuItem("Valid");
      v.addActionListener(new ValidAction());
      p = new JCheckBoxMenuItem("Propagating");
      p.addActionListener(new PropAction());
      delete = new JMenuItem("Delete");
      delete.addActionListener(new DeleteAction());
      duplicate = new JMenuItem("Duplicate");
      duplicate.addActionListener(new DuplicateAction());
      interp = new JMenuItem("Interpolate...");
      interp.addActionListener(new InterpAction());
      interpToMark = new JMenu("Interpolate to Mark");
      interpToMark.setEnabled(false);
      itmAction = new InterpToMarkAction();
      shift = new JMenuItem("Shift...");
      shift.addActionListener(new ShiftAction());
      shiftToMark = new JMenu("Shift to Mark");
      shiftToMark.setEnabled(false);
      stmAction = new ShiftToMarkAction();

      occlusions = new JMenuItem("Occlusions...");
      occAction = new OccAction();
      occlusions.addActionListener(occAction);
      occSeparator = new JSeparator();

      wrt = new JCheckBoxMenuItem("Display with Respect To", false);
      wrt.addActionListener(new WithRespectToAction());

      add(occlusions);
      add(occSeparator);
      add(v);
      add(p);
      add(occSeparator);
      add(delete);
      add(duplicate);
      add(occSeparator);
      add(interp);
      add(interpToMark);
      add(occSeparator);
      add(shift);
      add(shiftToMark);
      add(occSeparator);
      add(wrt);
    }
Beispiel #10
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);
  }
 /**
  * Creates a menu item.
  *
  * @param index The index associated to the item.
  * @return See above.
  */
 private JCheckBoxMenuItem createMenuItem(int index) {
   JCheckBoxMenuItem item = new JCheckBoxMenuItem(NAMES[index]);
   Font f = item.getFont();
   item.setFont(f.deriveFont(f.getStyle(), f.getSize() - 2));
   item.setSelected(filter == index);
   item.addActionListener(this);
   item.setActionCommand("" + index);
   return item;
 }
Beispiel #12
0
 @Override
 public JMenuItem getMenuPresenter() {
   if (checkbox == null) {
     checkbox =
         new JCheckBoxMenuItem(NbBundle.getMessage(MeasureAction.class, "CTL_MeasureAction"));
     checkbox.addActionListener(this);
   }
   return checkbox;
 }
 private JCheckBoxMenuItem addFilterMenuItem(
     String command, boolean defaultlistener, ParticlePicker picker) {
   JCheckBoxMenuItem mi = new JCheckBoxMenuItem(command);
   mifilters.add(mi);
   mi.setSelected(picker.isFilterAdded(command));
   if (defaultlistener) mi.addActionListener(this);
   filtersmn.add(mi);
   // mi.setEnabled(picker.getMode() != Mode.ReadOnly);
   return mi;
 }
 /**
  * Create the Statistics Menu, showing all available statistics for the chosen ChartableKstat.
  *
  * @param cks the ChartableKstat to show the statistics of in the menu
  * @param statistics the initial statistics, which will be checked
  * @return the Statistics Menu
  */
 protected JMenu statisticsMenu(ChartableKstat cks, List<String> statistics) {
   JMenu jmstat = new JMenu(KstatResources.getString("CHART.SHOW"));
   jmstat.setMnemonic(KeyEvent.VK_S);
   for (String stat : cks.getStatistics()) {
     JCheckBoxMenuItem jmi = new JCheckBoxMenuItem(stat, statistics.contains(stat));
     jmi.addActionListener(this);
     jmstat.add(jmi);
   }
   return jmstat;
 }
Beispiel #15
0
  /** Create the menu bar for the GUI */
  private void createMenu() {
    // Create menu bar
    menuBar = new JMenuBar();
    clientFrame.setJMenuBar(menuBar);

    // Create menus
    fileMenu = new JMenu("File");
    helpMenu = new JMenu("Help");

    // Add menus to bar
    menuBar.add(fileMenu);
    menuBar.add(helpMenu);

    // Create File Menu Items
    hostItem = new JCheckBoxMenuItem("Allow Uploads", true);
    portItem = new JCheckBoxMenuItem("Use Passive Mode", true);
    exitItem = new JMenuItem("Exit");

    // Add Items to File Menu
    fileMenu.add(hostItem);
    fileMenu.add(portItem);
    fileMenu.addSeparator();
    fileMenu.add(exitItem);

    // Create Help Menu Items
    helpItem = new JMenuItem("Help");
    aboutItem = new JMenuItem("About LeetFTP");

    // Add Items to Help Menu
    helpMenu.add(helpItem);
    helpMenu.addSeparator();
    helpMenu.add(aboutItem);

    // Create menu action handler and set it active
    MenuHandler menuHandler = new MenuHandler();

    hostItem.addActionListener(menuHandler);
    portItem.addActionListener(menuHandler);
    exitItem.addActionListener(menuHandler);
    helpItem.addActionListener(menuHandler);
    aboutItem.addActionListener(menuHandler);
  }
  /** Sets ACIDE - A Configurable IDE database panel menu item listeners. */
  public void setListeners() {

    // Sets the name menu item action listener
    _nameMenuItem.addActionListener(
        new AcideInsertedItemListener(
            AcideMenuItemsConfiguration.getInstance()
                .getSubmenu(AcideConfigurationMenu.CONFIGURATION_MENU_NAME)
                .getSubmenu(AcideDatabasePanelMenu.DATABASE_MENU_NAME)
                .getSubmenu(SHOW_DETAILS_NAME)
                .getItem(SHOW_NAME_NAME)));

    // Sets the name fields menu item action listener
    _nameFieldsMenuItem.addActionListener(
        new AcideInsertedItemListener(
            AcideMenuItemsConfiguration.getInstance()
                .getSubmenu(AcideConfigurationMenu.CONFIGURATION_MENU_NAME)
                .getSubmenu(AcideDatabasePanelMenu.DATABASE_MENU_NAME)
                .getSubmenu(SHOW_DETAILS_NAME)
                .getItem(SHOW_NAME_FIELDS_NAME)));

    // Sets the name fields menu item action listener
    _nameFieldsTypesMenuItem.addActionListener(
        new AcideInsertedItemListener(
            AcideMenuItemsConfiguration.getInstance()
                .getSubmenu(AcideConfigurationMenu.CONFIGURATION_MENU_NAME)
                .getSubmenu(AcideDatabasePanelMenu.DATABASE_MENU_NAME)
                .getSubmenu(SHOW_DETAILS_NAME)
                .getItem(SHOW_NAME_FIELDS_TYPES_NAME)));

    Iterator<AcideMenuObjectConfiguration> it = _insertedObjects.iterator();
    while (it.hasNext()) {
      AcideMenuObjectConfiguration ob = it.next();
      if (ob.isSubmenu()) {
        _insertedMenus.get(ob.getName()).addMouseListener(new AcideMenuBarMouseClickListener());
        _insertedMenus.get(ob.getName()).setListeners();
      } else {
        AcideInsertedItem aux = _insertedItems.get(ob.getName());
        aux.addActionListener((new AcideInsertedItemListener(aux)));
      }
    }
  }
Beispiel #17
0
  public TreeMenu() {
    super("Tree");
    this.setMnemonic('t');

    JMenuItem expandAllNodesItem = new JMenuItem(expand);
    expandAllNodesItem.addActionListener(new TreeActionListener(TREE_EXPAND_ALL_NODES));
    this.add(expandAllNodesItem);

    collapseNonExpNodesItem = new JCheckBoxMenuItem(collapse);
    collapseNonExpNodesItem.setSelected(PaintConfig.inst().collapse_no_exp);
    collapseNonExpNodesItem.addActionListener(new TreeActionListener(TREE_COLLAPSE_NONEXP_NODES));
    this.add(collapseNonExpNodesItem);

    // Separator line
    this.addSeparator();

    JCheckBoxMenuItem useDistances = new JCheckBoxMenuItem(distance);
    useDistances.setSelected(PaintConfig.inst().use_distances);
    useDistances.addActionListener(new TreeActionListener(TREE_USE_DISTANCES));
    this.add(useDistances);

    JMenuItem scaleTree = new JMenuItem(scale);
    scaleTree.addActionListener(new ScaleTreeActionListener());
    this.add(scaleTree);

    // Separator line
    this.addSeparator();

    JMenu tree_ordering = new JMenu(order);
    species_order = new JRadioButtonMenuItem(species);
    JRadioButtonMenuItem top_order = new JRadioButtonMenuItem(ladder_top);
    JRadioButtonMenuItem bottom_order = new JRadioButtonMenuItem(ladder_bottom);

    species_order.setSelected(true);

    ButtonGroup group = new ButtonGroup();
    group.add(species_order);
    group.add(top_order);
    group.add(bottom_order);

    species_order.addItemListener(new TreeReorderListener(TREE_SPECIES));
    top_order.addItemListener(new TreeReorderListener(TREE_TOP));
    bottom_order.addItemListener(new TreeReorderListener(TREE_BOTTOM));

    tree_ordering.add(species_order);
    tree_ordering.add(top_order);
    tree_ordering.add(bottom_order);

    this.add(tree_ordering);

    EventManager.inst().registerFamilyListener(this);
    EventManager.inst().registerNodeReorderListener(this);
  }
Beispiel #18
0
 protected void showTableHeaderPopup(MouseEvent e) {
   JPopupMenu popupMenu = new JPopupMenu();
   for (int i = 0; i < columnModel.getColumnCount(false); i++) {
     TableColumn tc = columnModel.getColumnByModelIndex(i);
     JCheckBoxMenuItem menuItem =
         new JCheckBoxMenuItem(
             dataTable.getModel().getColumnName(i), columnModel.isColumnVisible(tc));
     menuItem.addActionListener(new headerActionListener(tc));
     popupMenu.add(menuItem);
   }
   popupMenu.show(e.getComponent(), e.getX(), e.getY());
 }
Beispiel #19
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);
  }
  private static void addItem(JMenu menu, String text) {

    JCheckBoxMenuItem m =
        new JCheckBoxMenuItem(
            text.replaceFirst("/", "").replaceFirst("themepack", "").replaceFirst("\\.zip", ""));

    m.setActionCommand(text);

    m.addActionListener(new ChangeSkinAction());

    m.setSelected(text.equals(theme));

    menu.add(m);
  }
  public void addConfigurationAction(
      String category, ConfigurationAction<?> action, Activator activator) {
    JCheckBoxMenuItem item =
        MenuBar.makeMenuItem(action.getValue(Action.NAME).toString(), JCheckBoxMenuItem.class);
    menuBar.addItem(category, item);
    item.setToolTipText(action.getValue(Action.SHORT_DESCRIPTION).toString());
    item.setIcon((Icon) action.getValue(Action.SMALL_ICON));

    if (activator != null) {
      registerComponent(item, activator);
    }
    item.addActionListener(action);
    enableComponents.registerConfigurationAction(action, item);
  }
Beispiel #22
0
  /**
   * Create a JFSstat demo.
   *
   * @param jkstat a JKstat object
   * @param standalone if false, indicates that this demo is being called from another application
   */
  public JFSstat(JKstat jkstat, boolean standalone) {
    super("jfsstat", standalone);

    mainPanel = new JFSstatPanel(jkstat, DEFAULT_INTERVAL);

    setContentPane(mainPanel);

    addInfoPanel(mainPanel, sversion);

    displayset = new HashSet<JRadioButtonMenuItem>();
    JMenu displayMenu = new JMenu(SolViewResources.getString("FSSTAT.DISPLAY.TEXT"));
    displayMenu.setMnemonic(KeyEvent.VK_D);
    String curtitle = mainPanel.currentTitle();
    ButtonGroup displayGroup = new ButtonGroup();
    for (String title : mainPanel.titles()) {
      JRadioButtonMenuItem jmis = new JRadioButtonMenuItem(title, title.equals(curtitle));
      displayMenu.add(jmis);
      displayGroup.add(jmis);
      displayset.add(jmis);
      jmis.addActionListener(this);
    }
    addMenu(displayMenu);

    JMenu showMenu = new JMenu(SolViewResources.getString("FSSTAT.SHOW.TEXT"));
    showMenu.setMnemonic(KeyEvent.VK_S);
    hiddenItem = new JCheckBoxMenuItem(SolViewResources.getString("FSSTAT.HIDDEN.TEXT"), false);
    hiddenItem.addActionListener(this);
    showMenu.add(hiddenItem);
    aggrItem = new JCheckBoxMenuItem(SolViewResources.getString("FSSTAT.FSTYPE.TEXT"), false);
    aggrItem.addActionListener(this);
    showMenu.add(aggrItem);
    addMenu(showMenu);

    setSize(620, 250);
    validate();
    setVisible(true);
  }
 public boolean setDisableControlMenu(JPopupMenu popup) {
   if (_control) {
     disableItem = new JCheckBoxMenuItem(Bundle.getMessage("Disable"));
     disableItem.setSelected(!_controlling);
     popup.add(disableItem);
     disableItem.addActionListener(
         new ActionListener() {
           public void actionPerformed(java.awt.event.ActionEvent e) {
             setControlling(!disableItem.isSelected());
           }
         });
     return true;
   }
   return false;
 }
Beispiel #24
0
 protected void showTableHeaderPopup(MouseEvent e, JTable table) {
   JPopupMenu popupMenu = new JPopupMenu();
   XTableColumnModel tcm = (XTableColumnModel) table.getColumnModel();
   for (int i = 0; i < tcm.getColumnCount(false); i++) {
     TableColumn tc = tcm.getColumnByModelIndex(i);
     String columnName = table.getModel().getColumnName(i);
     if (columnName != null && !columnName.equals("")) {
       JCheckBoxMenuItem menuItem =
           new JCheckBoxMenuItem(table.getModel().getColumnName(i), tcm.isColumnVisible(tc));
       menuItem.addActionListener(new headerActionListener(tc, tcm));
       popupMenu.add(menuItem);
     }
   }
   popupMenu.show(e.getComponent(), e.getX(), e.getY());
 }
Beispiel #25
0
  public Vector getItems() {
    Vector items = new Vector();

    ActionListener al = new PopupMenuHandler();

    JMenuItem colorItem = new JMenuItem(colorString);
    colorItem.addActionListener(al);
    items.addElement(colorItem);

    JCheckBoxMenuItem dashedItem = new JCheckBoxMenuItem(dashedString);
    dashedItem.setSelected(dashed);
    dashedItem.addActionListener(al);
    items.addElement(dashedItem);

    return items;
  }
Beispiel #26
0
  /**
   * Make the view menu
   *
   * @param viewMenu view menu
   * @return The view menu
   */
  public JMenu makeViewMenu(JMenu viewMenu) {
    showAlignmentPointsMI = new JCheckBoxMenuItem("Show Alignment Points", true);
    viewMenu.add(showAlignmentPointsMI);
    showAlignmentPointsMI.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            repaint();
          }
        });

    viewMenu.addSeparator();
    super.makeViewMenu(viewMenu);
    viewMenu.addSeparator();
    viewMenu.add(makeMenuItem("Black background", CMD_BLACKBG));
    viewMenu.add(makeMenuItem("White background", CMD_WHITEBG));
    return viewMenu;
  }
  public static void refreshMenu() {
    MainMenu menu = Main.main.menu;

    if (cadastreJMenu == null) {
      cadastreJMenu =
          menu.addMenu(
              marktr("Cadastre"), KeyEvent.VK_C, menu.defaultMenuPos, ht("/Plugin/CadastreFr"));
      JosmAction grab = new MenuActionGrab();
      JMenuItem menuGrab = new JMenuItem(grab);
      KeyStroke ks = grab.getShortcut().getKeyStroke();
      if (ks != null) {
        menuGrab.setAccelerator(ks);
      }
      JMenuItem menuActionGrabPlanImage = new JMenuItem(new MenuActionGrabPlanImage());
      JMenuItem menuSettings = new JMenuItem(new MenuActionNewLocation());
      final JCheckBoxMenuItem menuSource = new JCheckBoxMenuItem(tr("Auto sourcing"));
      menuSource.setSelected(autoSourcing);
      menuSource.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent ev) {
              Main.pref.put("cadastrewms.autosourcing", menuSource.isSelected());
              autoSourcing = menuSource.isSelected();
            }
          });

      // JMenuItem menuResetCookie = new JMenuItem(new MenuActionResetCookie());
      // JMenuItem menuLambertZone = new JMenuItem(new MenuActionLambertZone());
      JMenuItem menuLoadFromCache = new JMenuItem(new MenuActionLoadFromCache());
      // temporary disabled:
      // JMenuItem menuActionBoundaries = new JMenuItem(new MenuActionBoundaries());
      // JMenuItem menuActionBuildings = new JMenuItem(new MenuActionBuildings());

      cadastreJMenu.add(menuGrab);
      cadastreJMenu.add(menuActionGrabPlanImage);
      cadastreJMenu.add(menuSettings);
      cadastreJMenu.add(menuSource);
      // cadastreJMenu.add(menuResetCookie); not required any more
      // cadastreJMenu.add(menuLambertZone);
      // if (Main.pref.getBoolean("cadastrewms.buildingsMenu", false))
      //    cadastreJMenu.add(menuActionBuildings);
      cadastreJMenu.add(menuLoadFromCache);
      // all SVG features disabled until official WMS is released
      // cadastreJMenu.add(menuActionBoundaries);
    }
    setEnabledAll(menuEnabled);
  }
 private void addMenuItemListener(final JCheckBoxMenuItem menuItem) {
   final boolean[] internalChange = new boolean[1];
   menuItem.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent e) {
           if (internalChange[0]) return;
           final int column = Integer.parseInt(e.getActionCommand());
           if (column == 5 && !fieldsListTableModel.isRealColumnVisible(column)) {
             BrowserUtils.performTask(
                 new Runnable() {
                   public void run() {
                     final int retainedSizesState =
                         referencesBrowserController
                             .getReferencesControllerHandler()
                             .getHeapFragmentWalker()
                             .computeRetainedSizes(false);
                     SwingUtilities.invokeLater(
                         new Runnable() {
                           public void run() {
                             if (retainedSizesState
                                 != HeapFragmentWalker.RETAINED_SIZES_COMPUTED) {
                               internalChange[0] = true;
                               menuItem.setSelected(!menuItem.isSelected());
                               internalChange[0] = false;
                             } else {
                               fieldsListTableModel.setRealColumnVisibility(
                                   column, !fieldsListTableModel.isRealColumnVisible(column));
                               fieldsListTable.createDefaultColumnsFromModel();
                               fieldsListTable.updateTreeTableHeader();
                               setColumnsData();
                             }
                           }
                         });
                   }
                 });
           } else {
             fieldsListTableModel.setRealColumnVisibility(
                 column, !fieldsListTableModel.isRealColumnVisible(column));
             fieldsListTable.createDefaultColumnsFromModel();
             fieldsListTable.updateTreeTableHeader();
             setColumnsData();
           }
         }
       });
 }
  /** Sets the listeners of the window components. */
  public void setListeners() {

    // Sets the console display options menu item action listener
    _consoleDisplayOptionsMenuItem.addActionListener(
        new AcideConsoleDisplayOptionsMenuItemAction());

    // Sets the save console content into file menu item action listener
    _saveConsoleContentIntoFile.addActionListener(new AcideSaveConsoleIntoFileMenuItemAction());

    // Sets the document lexicon menu item action listener
    _documentLexiconMenuItem.addActionListener(new AcideDocumentLexiconMenuItemAction());

    // Sets the copy menu item action listener
    _copyMenuItem.addActionListener(new AcideCopyMenuItemAction());

    // Sets the cut menu item action listener
    _cutMenuItem.addActionListener(new AcideCutMenuItemAction());

    // Sets the paste menu item action listener
    _pasteMenuItem.addActionListener(new AcidePasteMenuItemAction());

    String OSName = System.getProperty("os.name");

    // If it is WINDOWS
    if (!OSName.toUpperCase().contains("WIN")) {

      // Sets the controlC menu item action listener
      _controlCMenuItem.addActionListener(new AcideControlCMenuItemAction());
    }

    // Sets the reset menu item action listener
    _resetMenuItem.addActionListener(new AcideResetMenuItemAction());

    // Sets the clear console buffer menu item action listener
    _clearConsoleBufferMenuItem.addActionListener(new AcideClearConsoleBufferMenuItemAction());

    // Sets the search menu item action listener
    _searchMenuItem.addActionListener(new AcideConsolePanelSearchMenuItemAction());

    // Sets the close console menu item action listener
    _closeConsoleMenuItem.addActionListener(new AcideCloseConsoleMenuItemAction());

    // Sets the console line wrapping check box menu item action listener
    _lineWrappingMenuItem.addActionListener(new AcideLineWrappingMenuItemAction());
  }
  private JPopupMenu getMyTableColumnSelectionPopupMenu(
      final JTable jTable1, final int mouseXLocation) {
    JPopupMenu popup = new JPopupMenu();
    TableModel tableModel = jTable1.getModel();
    final int col = tableModel.getColumnCount();

    for (int i = this.menuStartIndex; i < col; i++) {
      String name = tableModel.getColumnName(i);

      // Do not display the menu with name which is ignored by user.
      if (columnNamesToBeIgnored.contains(name)) {
        continue;
      }

      boolean isVisible = true;

      try {
        TableColumn tableColumn = jTable1.getColumn(name);
      } catch (java.lang.IllegalArgumentException exp) {
        isVisible = false;
      }

      javax.swing.JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(name, isVisible);

      menuItem.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
              String name = evt.getActionCommand();
              JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) evt.getSource();
              if (menuItem.isSelected() == false) {
                JTableUtilities.removeTableColumn(jTable1, name);
              } else {
                TableColumnModel colModel = jTable1.getColumnModel();
                int vColIndex = colModel.getColumnIndexAtX(mouseXLocation);
                JTableUtilities.insertTableColumnFromModel(jTable1, name, vColIndex);
              }
            }
          });

      popup.add(menuItem);
    }

    return popup;
  }