/** Sets the visibility of the column with the specified name. */
  public void setColumnVisible(String name, boolean visible) {
    // Get column and set visibility.
    TableColumnExt column = getColumnExt(name);
    column.setVisible(visible);

    // Get column title.
    String columnTitle = column.getTitle();

    // Find checkbox menu item with matching title.
    JCheckBoxMenuItem matchingItem = null;
    int itemCount = headerPopup.getComponentCount();
    for (int i = 0; i < itemCount; i++) {
      Component menuComponent = headerPopup.getComponent(i);
      if (menuComponent instanceof JCheckBoxMenuItem) {
        JCheckBoxMenuItem item = (JCheckBoxMenuItem) menuComponent;
        String itemTitle = item.getText();
        if (itemTitle.equals(columnTitle)) {
          matchingItem = item;
          break;
        }
      }
    }

    // Select matching menu item.
    if (matchingItem != null) {
      matchingItem.setSelected(visible);
    }
  }
  @Override
  public void actionPerformed(ActionEvent e) {
    try {
      JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
      activefilter = item.getText();
      if (item.isSelected()) // filter added, will be registered by picker
        // with options if needed
        if (activefilter.equals(ParticlePicker.xmippsmoothfilter)) {
          getParticlePicker().addFilter(ParticlePicker.xmippsmoothfilter, "xmipp");
          reloadImage();
        } else {
          command = activefilter;
          applyFilter(activefilter);
        }
      else {
        // filter removed
        getParticlePicker().removeFilter(activefilter);
        reloadImage();
        if (particlesdialog != null) loadParticles(true);
      }
      if (getParticlePicker().getMode() != Mode.ReadOnly) getParticlePicker().saveConfig();
    } catch (Exception ex) {

      ex.printStackTrace();
      showException(ex);
    }
  }
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == exitItem) {
     kbc.stopLoop();
     setVisible(false);
     dispose();
   } else if (e.getSource() == saveItem) {
     saveImage();
   } else if (e.getSource() == sleepItem1) {
     setDelay(1);
   } else if (e.getSource() == sleepItem2) {
     setDelay(2);
   } else if (e.getSource() == sleepItem5) {
     setDelay(5);
   } else if (e.getSource() == sleepItem10) {
     setDelay(10);
   } else if (e.getSource() instanceof JCheckBoxMenuItem) {
     JCheckBoxMenuItem jmi = (JCheckBoxMenuItem) e.getSource();
     String stat = jmi.getText();
     if (jmi.isSelected()) {
       kbc.addStatistic(stat);
     } else {
       kbc.removeStatistic(stat);
     }
   }
 }
Beispiel #4
0
 private JComponent createToolPanel() {
   JComponent box = Box.createVerticalBox();
   JCheckBox button = new JCheckBox(disablingItem.getText());
   button.setModel(disablingItem.getModel());
   box.add(Box.createGlue());
   box.add(button);
   box.add(Box.createGlue());
   JRadioButton blur = new JRadioButton(blurItem.getText());
   blur.setModel(blurItem.getModel());
   box.add(blur);
   JRadioButton emboss = new JRadioButton(embossItem.getText());
   emboss.setModel(embossItem.getModel());
   box.add(emboss);
   JRadioButton translucent = new JRadioButton(busyPainterItem.getText());
   translucent.setModel(busyPainterItem.getModel());
   box.add(translucent);
   box.add(Box.createGlue());
   return box;
 }
Beispiel #5
-1
  /**
   * Invoked when an item has been selected or deselected by the user.
   *
   * <p>Invoked when an item has been selected or deselected by the user. The code written for this
   * method performs the operations that need to occur when an item is selected (or deselected).
   */
  public void itemStateChanged(ItemEvent e) {
    /* format menu */
    if (e.getSource() == wordWrap) {
      editor.setLineWrap(!editor.getLineWrap());
      side.setLineWrap(editor.getLineWrap());
      // wordWrap.setText(editor.getLineWrap() ? "Disable Word Wrap" : "Enable Word Wrap");
      wordWrap.setDisplayedMnemonicIndex(wordWrap.getText().indexOf('W'));
    }

    /* view menu */
    if (e.getSource() == toggleSide) {
      // hide the sidePane, sideButton, and update the text in the toggleSide JMenuItem (need to
      // update mnemonicindex as well)
      sidePane.setVisible(!sidePane.isVisible());
      sideButton.setVisible(sidePane.isVisible());
      // toggleSide.setText(sidePane.isVisible() ? "Hide Side Pane" : "Show Side Pane");
      toggleSide.setDisplayedMnemonicIndex(5);

      // easier to remove everything and then add them back
      centerPanel.removeAll();
      centerPanel.add(editorPane);
      if (sideButton.isVisible()) {
        centerPanel.add(sidePane);
      }
      centerPanel.validate();
    }
  }