Exemple #1
0
  /**
   * Get the image group from the gui.
   *
   * @return The iamge group.
   */
  protected String getGroup() {
    Object selected = groupSelector.getSelectedItem();
    if (selected == null) {
      return null;
    }
    if (selected instanceof AddeServer.Group) {
      AddeServer.Group group = (AddeServer.Group) selected;
      return group.getName();
    }

    String groupName = selected.toString().trim();
    if ((groupName.length() > 0)) {
      // Force the get in case they typed a server name
      getServer();
      AddeServer server = getAddeServer();
      if (server != null) {
        AddeServer.Group group =
            getIdv().getIdvChooserManager().addAddeServerGroup(server, groupName, getGroupType());
        if (!group.getActive()) {
          getIdv().getIdvChooserManager().activateAddeServerGroup(server, group);
        }
        // Now put the list of groups back in to the selector
        setGroups();
        groupSelector.setSelectedItem(group);
      }
    }

    return groupName;
  }
  private void onBatch() {
    final boolean b = useBatchInputCheckbox.isSelected();

    orientationComboBox.setEnabled(b);
    lengthField.setEnabled(b);
    dpiXField.setEnabled(b);
    dpiYField.setEnabled(b);
    startDepthField.setEnabled(b);
    depthIncField.setEnabled(b);
    applyToAllButton.setEnabled(b);
    applyToSelectedButton.setEnabled(b);

    if (!b) {
      orientationLabel.setEnabled(b);
      lengthLabel.setEnabled(b);
      dpiXLabel.setEnabled(b);
      dpiYLabel.setEnabled(b);
      startDepthLabel.setEnabled(b);
      depthIncLabel.setEnabled(b);
    } else {
      orientationLabel.setEnabled(orientationComboBox.getSelectedIndex() != 2); // [Blank]
      lengthLabel.setEnabled(!lengthField.getText().equals(""));
      dpiXLabel.setEnabled(!dpiXField.getText().equals(""));
      dpiYLabel.setEnabled(!dpiYField.getText().equals(""));
      startDepthLabel.setEnabled(!startDepthField.getText().equals(""));
      depthIncLabel.setEnabled(!depthIncField.getText().equals(""));
    }
  }
Exemple #3
0
  /**
   * return the String id of the chosen server name
   *
   * @return the server name
   */
  public String getServer() {
    Object selected = serverSelector.getSelectedItem();
    if (selected == null) {
      return null;
    }
    AddeServer server;
    if (selected instanceof AddeServer) {
      server = (AddeServer) selected;
      return server.getName();
    }
    String serverName = selected.toString();
    server = getIdv().getIdvChooserManager().addAddeServer(serverName);
    addeServers = getIdv().getIdvChooserManager().getAddeServers(getGroupType());

    Object selectedGroup = groupSelector.getSelectedItem();
    AddeServer.Group group = null;
    if (selectedGroup != null) {
      group =
          getIdv()
              .getIdvChooserManager()
              .addAddeServerGroup(server, selectedGroup.toString(), getGroupType());
    }

    boolean old = ignoreStateChangedEvents;
    ignoreStateChangedEvents = true;
    GuiUtils.setListData(serverSelector, addeServers);
    serverSelector.setSelectedItem(server);
    setGroups();
    if (group != null) {
      groupSelector.setSelectedItem(group);
    }
    ignoreStateChangedEvents = old;
    return server.getName();
  }
  /*
   * Gets the user choice for font, style and size and redraws the text
   *     accordingly.
   */
  public void setSampleFont() {
    // Get the font name from the JComboBox
    fontName = (String) facenameCombo.getSelectedItem();

    sampleField.setText(textField.getText());

    // Get the font style from the JCheckBoxes
    fontStyle = 0;
    if (italicCheckBox.isSelected()) fontStyle += Font.ITALIC;
    if (boldCheckBox.isSelected()) fontStyle += Font.BOLD;

    // Get the font size
    fontSize = 0;

    fontSize = Integer.parseInt((String) sizeCombo.getSelectedItem());

    // THE FOLLOWING IS NO LONGER NEEDED
    //            if(smallButton.isSelected())
    //                  fontSize=SMALL;
    //            else if(mediumButton.isSelected())
    //                  fontSize=MEDIUM;
    //            else if(largeButton.isSelected())
    //                  fontSize=LARGE;

    // Set the font of the text field
    sampleField.setFont(new Font(fontName, fontStyle, fontSize));
    sampleField.setForeground(fontColor);
    sampleField.repaint();

    pack();
  } // end setSampleFont method
Exemple #5
0
  private void setComponentsEnabled(boolean enabled) {
    list.setEnabled(enabled);
    process.setEnabled(enabled);
    remove.setEnabled(enabled);
    xres.setEnabled(enabled);
    yres.setEnabled(enabled);
    aspect.setEnabled(enabled);

    boolean b = aspect.isSelected() && enabled;
    colorLabel.setEnabled(b);
    colorBox.setEnabled(b);
    redLabel.setEnabled(b);
    red.setEnabled(b);
    redValue.setEnabled(b);
    greenLabel.setEnabled(b);
    green.setEnabled(b);
    greenValue.setEnabled(b);
    blueLabel.setEnabled(b);
    blue.setEnabled(b);
    blueValue.setEnabled(b);

    format.setEnabled(enabled);
    algorithm.setEnabled(enabled);
    prepend.setEnabled(enabled);
    append.setEnabled(enabled);
    output.setEnabled(enabled);
  }
 public void actionPerformed(ActionEvent e) {
   if (cyear.getSelectedItem() != null) {
     String b = cyear.getSelectedItem().toString();
     currentYear = Integer.parseInt(b);
     refreshCalendar(currentMonth, currentYear);
   }
 }
 public void run() {
   try {
     thread.sleep(1111);
   } catch (Exception e) {
     return;
   }
   Thread me = Thread.currentThread();
   while (thread == me) {
     for (int i = 0; i < ImageOps.imgName.length; i++) {
       imgCombo.setSelectedIndex(i);
       for (int j = 0; j < ImageOps.opsName.length; j++) {
         opsCombo.setSelectedIndex(j);
         if (j <= 1) {
           for (int k = 50; k <= 200; k += 10) {
             demo.slider1.setValue(k);
             try {
               thread.sleep(200);
             } catch (InterruptedException e) {
               return;
             }
           }
         }
         try {
           thread.sleep(4444);
         } catch (InterruptedException e) {
           return;
         }
       }
     }
   }
   thread = null;
 }
Exemple #8
0
 public void actionPerformed(ActionEvent evt) {
   JComboBox cb = (JComboBox) evt.getSource();
   String format = (String) cb.getSelectedItem();
   if (format.equals("all formats")) {
     format = null;
   }
   fileList.setListData(findFiles(AUDIO_DIR, format));
 }
 private void initComboBox(JComboBox combo) {
   if (combo.getUI() instanceof WindowsComboBoxUI) {
     combo.setUI(new RightPopupWindowsComboBoxUI());
   } else {
     combo.setUI(new RightPopupBasicComboBoxUI());
   }
   combo.addPopupMenuListener(new RightPopupMenuListener());
 }
Exemple #10
0
    // implemented for ActionListener event handling
    public void actionPerformed(ActionEvent e) {
      String actionCmd = e.getActionCommand();
      Stack locStack = parentBrowserFrame.locationStack;
      Stack fwdStack = parentBrowserFrame.forwardStack;

      if (actionCmd.equals(homeCmd)) // event from home button
      {
        fwdStack.removeAllElements();
        parentBrowserFrame.setBrowserLocation(mainBrowserURL);
      } else if (actionCmd.equals(backCmd)) // event from back button
      {
        if (!locStack.isEmpty()) {
          String myLocale = (String) (locStack.pop());

          // push current location on forward stack
          fwdStack.push(location);
          getForwardButton().setEnabled(true);

          // do *not* cache the last location in the stack
          parentBrowserFrame.setBrowserLocation(myLocale, false);
        }
      } else if (actionCmd.equals(forwardCmd)) // event from forward button
      {
        if (!fwdStack.isEmpty()) {
          // remove location from forward stack
          String newLoc = (String) (fwdStack.pop());

          // DO add the current location to the back stack
          parentBrowserFrame.setBrowserLocation(newLoc);
        }
      } else if (actionCmd.equals(comboCmd)) // event from URL combo box!
      {
        if (e.getSource() instanceof JComboBox) // just to be sure
        {
          JComboBox thisBox = (JComboBox) e.getSource();

          String newLoc = thisBox.getSelectedItem().toString();
          if (newLoc != null && !newLoc.equals("")) // ignore empty selections
          {
            if (thisBox.getSelectedIndex() == -1) {
              thisBox.insertItemAt(newLoc, 0);
            }
            fwdStack.removeAllElements();
            parentBrowserFrame.setBrowserLocation(newLoc);
          }
        }
      }

      // disable the back button if we find the location stack is empty
      if (locStack.isEmpty()) {
        getBackButton().setEnabled(false);
      }

      // disable forward button if forward stack is empty
      if (fwdStack.isEmpty()) {
        getForwardButton().setEnabled(false);
      }
    }
Exemple #11
0
 /**
  * creates a new channel, if the channel exists it is removed (this method doubles as a
  * removeChannel)
  *
  * @param name the name of the channel
  */
 public void newChannel(String name, boolean pass) {
   if (channels.containsKey(name)) {
     channels.remove(name);
     cboChannels.removeItem(name);
   } else {
     channels.put(name, new Boolean(pass));
     cboChannels.addItem(name);
   }
 }
Exemple #12
0
 /**
  * Create a default filename given the current date selection. If custom dates are selected, use
  * those dates; otherwise, use year and week numbers.
  *
  * @return The default filename.
  */
 private String getDefaultFilename() {
   if (yearCB.getSelectedIndex() == 0 || weekCB.getSelectedIndex() == 0)
     return "timesheet-"
         + dateFormat.format(fromDate.getDate()).replaceAll("/", "")
         + "-"
         + dateFormat.format(toDate.getDate()).replaceAll("/", "")
         + ".txt";
   return "timesheet-" + yearCB.getSelectedItem() + "wk" + weekCB.getSelectedItem() + ".txt";
 }
Exemple #13
0
  public void buildPopulationBox() {
    rebuilding = true;
    populationBox.removeAll();
    peopleList = new ArrayList<Object>();
    famList = new ArrayList<Family>();
    peopleList.addAll(ctxt.individualCensus);
    String plur = (peopleList.size() == 1 ? "" : "s");
    populationBox.setLayout(new BoxLayout(populationBox, BoxLayout.PAGE_AXIS));
    populationBox.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createLineBorder(Color.blue), "Current Population"));
    populationBox.setAlignmentX(0.5f);
    populationBox.add(Box.createRigidArea(new Dimension(8, 0)));
    indivLabel = new JLabel("Contains " + peopleList.size() + " Individual" + plur);
    indivLabel.setAlignmentX(0.5f);
    populationBox.add(indivLabel);
    if (peopleList.size() > 0) {
      JPanel indivBtnBox = new JPanel();
      indivBtnBox.setLayout(new BoxLayout(indivBtnBox, BoxLayout.LINE_AXIS));
      Dimension sizer2 = new Dimension(350, 50);
      String[] indMenu = genIndMenu(peopleList);
      indPick = new JComboBox(indMenu);
      indPick.addActionListener(listener);
      indPick.setActionCommand("view/edit person");
      indPick.setMinimumSize(sizer2);
      indPick.setMaximumSize(sizer2);
      indPick.setBorder(
          BorderFactory.createTitledBorder(
              BorderFactory.createLineBorder(Color.blue), "View/Edit Person"));
      indivBtnBox.add(indPick);
      populationBox.add(indivBtnBox);
    } //  end of if-any-people-exist

    famList.addAll(ctxt.familyCensus); //  end of filtering deleted records
    plur = (famList.size() == 1 ? "y" : "ies");
    famLabel = new JLabel("Contains " + famList.size() + " Famil" + plur);
    famLabel.setAlignmentX(0.5f);
    populationBox.add(Box.createRigidArea(new Dimension(0, 4)));
    populationBox.add(famLabel);
    if (famList.size() > 0) {
      JPanel famBtnBox = new JPanel();
      famBtnBox.setLayout(new BoxLayout(famBtnBox, BoxLayout.LINE_AXIS));
      Dimension sizer2 = new Dimension(350, 50);
      String[] famMenu = genFamMenu(famList);
      famPick = new JComboBox(famMenu);
      famPick.addActionListener(listener);
      famPick.setActionCommand("view/edit family");
      famPick.setMinimumSize(sizer2);
      famPick.setMaximumSize(sizer2);
      famPick.setBorder(
          BorderFactory.createTitledBorder(
              BorderFactory.createLineBorder(Color.blue), "View/Edit Family"));
      famBtnBox.add(famPick);
      populationBox.add(famBtnBox);
    } //  end of if-any-families-exist
    rebuilding = false;
  } //  end of method buildPopulationBox
Exemple #14
0
  private void loadPreferences() {
    // grab the preferences so that they can be used to fill out the layout
    ThumbMakerPreferences myPreferences = ThumbMakerPreferences.getInstance();

    // x resolution text box
    xres.setText(myPreferences.getStringPref(ThumbMakerPreferences.RES_WIDTH_PREF_NAME));

    // y resolution text box
    yres.setText(myPreferences.getStringPref(ThumbMakerPreferences.RES_HEIGHT_PREF_NAME));

    // aspect ratio checkbox
    aspect.setSelected(
        myPreferences
            .getStringPref(ThumbMakerPreferences.DO_MAINTAIN_ASPECT_PREF_NAME)
            .equalsIgnoreCase(ThumbMakerPreferences.BOOLEAN_TRUE_STRING));

    // load the color values from the preferences
    int redValueNumber = myPreferences.getIntegerPref(ThumbMakerPreferences.RED_VALUE_PREF_NAME);
    int greenValueNumber =
        myPreferences.getIntegerPref(ThumbMakerPreferences.GREEN_VALUE_PREF_NAME);
    int blueValueNumber = myPreferences.getIntegerPref(ThumbMakerPreferences.BLUE_VALUE_PREF_NAME);

    // set the background color image
    colorBox.setBackground(new Color(redValueNumber, greenValueNumber, blueValueNumber));

    // red slider
    red.setValue(redValueNumber);
    redValue.setText("" + redValueNumber);

    // green slider
    green.setValue(greenValueNumber);
    greenValue.setText("" + greenValueNumber);

    // blue slider
    blue.setValue(blueValueNumber);
    blueValue.setText("" + blueValueNumber);

    // algorithm combo box
    algorithm.setSelectedIndex(
        myPreferences.getIntegerPref(ThumbMakerPreferences.RESIZE_ALG_PREF_NAME));

    // format combo box
    format.setSelectedIndex(
        myPreferences.getIntegerPref(ThumbMakerPreferences.THUMB_FORMAT_PREF_NAME));

    // prepend field
    prepend.setText(myPreferences.getStringPref(ThumbMakerPreferences.STRING_TO_PREPEND_PREF_NAME));

    // append field
    append.setText(myPreferences.getStringPref(ThumbMakerPreferences.STRING_TO_APPEND_PREF_NAME));

    // output folder field
    output.setText(
        (new File(myPreferences.getStringPref(ThumbMakerPreferences.FILE_PATH_STRING_PREF_NAME)))
            .getAbsolutePath());
  }
Exemple #15
0
  @Override
  public void adoptElement(SceneElement elem) {
    if (!(elem instanceof NenyaImageSceneElement
        || elem instanceof NenyaTileSceneElement
        || elem instanceof NenyaComponentSceneElement)) {
      enableEditor(false);
      return;
    }

    DefaultComboBoxModel dcm = (DefaultComboBoxModel) itemList.getModel();

    // Important: Work on a copy, not on the original. Otherwise we mess up the undomanager
    sceneElement = elem.copy();

    if ((sceneElement instanceof NenyaImageSceneElement) && !locked) {
      dcm.removeAllElements();
      String[] tmp = ((NenyaImageSceneElement) sceneElement).getPath();
      dcm.addElement(tmp[tmp.length - 1]);
    }
    if ((sceneElement instanceof NenyaTileSceneElement) && !locked) {
      dcm.removeAllElements();
      dcm.addElement(((NenyaTileSceneElement) sceneElement).getTileName());
    }
    if ((sceneElement instanceof NenyaComponentSceneElement) && !locked) {
      dcm.removeAllElements();
      NenyaComponentItem[] ni = ((NenyaComponentSceneElement) sceneElement).getComponents();
      for (NenyaComponentItem element : ni) {
        dcm.addElement(element);
      }
    }

    try {
      ClassedItem[] cols = null;
      if (elem instanceof NenyaTileSceneElement)
        cols = ((NenyaTileSceneElement) elem).getColorList();
      if (elem instanceof NenyaImageSceneElement)
        cols = ((NenyaImageSceneElement) elem).getColorList();
      if (elem instanceof NenyaComponentSceneElement) {
        NenyaComponentItem nci = (NenyaComponentItem) dcm.getSelectedItem();
        cols = nci.getColorList();
      }
      Vector<TreePath> collect = new Vector<TreePath>();
      TreeNode root = (TreeNode) colors.getModel().getRoot();
      for (ClassedItem col : cols) {
        String[] tmp = {root.toString(), col.getClassName(), col.getItemName()};
        collect.add(TreeUtil.findPath(root, tmp));
      }
      TreePath[] path = collect.toArray(new TreePath[0]);
      colors.getSelectionModel().setSelectionPaths(path);
    } catch (Exception e) {
      // Either the tree is filtered away or the selected item is not colorized.
    }

    enableEditor(true);
    itemList.setEnabled(elem instanceof NenyaComponentSceneElement);
  }
  private void updateEnabled() {
    combo.setEnabled(action.isSelected());
    list.setEnabled(action.isSelected());

    boolean iconControlsEnabled = !separator.isSelected();
    builtin.setEnabled(iconControlsEnabled);
    file.setEnabled(iconControlsEnabled);
    builtinCombo.setEnabled(iconControlsEnabled && builtin.isSelected());
    fileButton.setEnabled(iconControlsEnabled && file.isSelected());
  }
 private void addPainter(myjava.gui.syntax.Painter painter) {
   EntryListPanel newPanel = new EntryListPanel(painter);
   listPanelSet.add(newPanel);
   centerPanel.add(newPanel, painter.getName());
   painterComboBox.removeItemListener(painterChangeListener);
   painterComboBox.removeAllItems();
   for (EntryListPanel p : listPanelSet) {
     painterComboBox.addItem(p.getPainter());
   }
   removedPainters.remove(painter);
   painterComboBox.addItemListener(painterChangeListener);
 }
Exemple #18
0
  /*
  Post: sets up all the options visually
  */
  public Options() {

    valuesArray = new ArrayList<Integer>();
    populateRandomArray();

    // size of the array
    enterSize = new JLabel("Array size:");
    arraySizeEntry = new JTextField("", 3);
    arraySizeEntry.addActionListener(this);
    arraySizeEntry.getDocument().addDocumentListener(new DocListener());

    // algorithm on top
    topAlgo = new JLabel("Top:");
    String[] topAlgos = {"Selection Sort", "Insertion Sort", "Bubble Sort", "Merge Sort"};
    chooseTopAlgo = new JComboBox(topAlgos);
    chooseTopAlgo.addActionListener(this);

    // algorithm on bottom
    bottomAlgo = new JLabel("Bottom:");
    String[] bottomAlgos = {"Selection Sort", "Insertion Sort", "Bubble Sort", "Merge Sort"};
    chooseBottomAlgo = new JComboBox(bottomAlgos);
    chooseBottomAlgo.addActionListener(this);

    // average case or worst case
    caseLabel = new JLabel("Choose case:");
    String[] cases = {"Average Case", "Worst Case"};
    chooseCase = new JComboBox(cases);
    chooseCase.addActionListener(this);

    // delay of comparisons in the visualizer
    enterSpeed = new JLabel("Delay:");
    speedEntry = new JTextField("10", 2);
    speedEntry.addActionListener(this);
    speedEntry.getDocument().addDocumentListener(this);

    // run button (runs the visualizer)
    run = new JButton("Run");
    run.addActionListener(this);
    // adding everything to the panel
    add(enterSize);
    add(arraySizeEntry);
    add(topAlgo);
    add(chooseTopAlgo);
    add(bottomAlgo);
    add(chooseBottomAlgo);
    add(caseLabel);
    add(chooseCase);
    add(enterSpeed);
    add(speedEntry);
    add(run);
  }
Exemple #19
0
  /** Set the group list */
  protected void setGroups() {
    AddeServer server = getAddeServer();
    if (server != null) {
      Object selected = groupSelector.getSelectedItem();
      List groups = server.getGroupsWithType(getGroupType());
      GuiUtils.setListData(groupSelector, groups);
      if ((selected != null) && groups.contains(selected)) {
        groupSelector.setSelectedItem(selected);
      }

    } else {
      GuiUtils.setListData(groupSelector, new Vector());
    }
  }
Exemple #20
0
 /**
  * Set calendar to this week's Monday; set year and week combo boxes to the currently set date;
  * set the date labels appropriately; and, refresh the review table.
  */
 private void updateYearWeekDates() {
   yearWeekCalendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
   yearWeekCalendar.set(Calendar.HOUR_OF_DAY, 0);
   yearWeekCalendar.set(Calendar.MINUTE, 0);
   yearWeekCalendar.set(Calendar.SECOND, 0);
   yearWeekCalendar.set(Calendar.MILLISECOND, 0);
   yearCB.setSelectedItem(yearWeekCalendar.get(Calendar.YEAR));
   weekCB.setSelectedItem(yearWeekCalendar.get(Calendar.WEEK_OF_YEAR));
   fromDate.setDate(yearWeekCalendar);
   yearWeekCalendar.add(Calendar.DAY_OF_MONTH, 7);
   toDate.setDate(yearWeekCalendar);
   yearWeekCalendar.add(Calendar.DAY_OF_MONTH, -7);
   refreshReviewTable();
 }
    public void popupMenuWillBecomeInvisible(PopupMenuEvent ev) {
      Point cpos = combo1.getLocation();
      SwingUtilities.convertPointToScreen(cpos, panel);

      JPopupMenu pm = (JPopupMenu) combo1.getUI().getAccessibleChild(combo1, 0);

      if (pm != null) {
        Point p = pm.getLocation();
        SwingUtilities.convertPointToScreen(p, pm);
        if (p.y < cpos.y) {
          throw new RuntimeException("ComboBox popup is wrongly aligned");
        } // check that popup was opened down
      }
    }
    /**
     * Set the fields from the ProjectionClass
     *
     * @param projClass projection class to use
     */
    private void setFieldsWithClassParams(ProjectionClass projClass) {

      // set the projection in the JComboBox
      String want = projClass.toString();
      for (int i = 0; i < projClassCB.getItemCount(); i++) {
        ProjectionClass pc = (ProjectionClass) projClassCB.getItemAt(i);
        if (pc.toString().equals(want)) {
          projClassCB.setSelectedItem((Object) pc);
          break;
        }
      }

      // set the parameter fields
      paramPanel.removeAll();
      paramPanel.setVisible(0 < projClass.paramList.size());

      List widgets = new ArrayList();
      for (int i = 0; i < projClass.paramList.size(); i++) {
        ProjectionParam pp = (ProjectionParam) projClass.paramList.get(i);
        // construct the label
        String name = pp.name;
        String text = "";
        // Create a decent looking label
        for (int cIdx = 0; cIdx < name.length(); cIdx++) {
          char c = name.charAt(cIdx);
          if (cIdx == 0) {
            c = Character.toUpperCase(c);
          } else {
            if (Character.isUpperCase(c)) {
              text += " ";
              c = Character.toLowerCase(c);
            }
          }
          text += c;
        }
        widgets.add(GuiUtils.rLabel(text + ": "));
        // text input field
        JTextField tf = new JTextField();
        pp.setTextField(tf);
        tf.setColumns(12);
        widgets.add(tf);
      }
      GuiUtils.tmpInsets = new Insets(4, 4, 4, 4);
      JPanel widgetPanel = GuiUtils.doLayout(widgets, 2, GuiUtils.WT_N, GuiUtils.WT_N);

      paramPanel.add("North", widgetPanel);
      paramPanel.add("Center", GuiUtils.filler());
    }
Exemple #23
0
  @Override
  public void valueChanged(TreeSelectionEvent e) {
    if (e.getSource() == colors && !locked) {
      TreeSelectionModel tsm = colors.getSelectionModel();
      TreePath tp[] = tsm.getSelectionPaths();
      if (tp == null) return;
      Vector<ClassedItem> tmp = new Vector<ClassedItem>();
      for (TreePath element : tp) {
        try {
          Object[] path = element.getPath();
          ClassedItem ci = new ClassedItem(path[1].toString(), path[2].toString());
          tmp.add(ci);
        } catch (Exception exp) {
          // User did not select a leafnode
        }
      }

      if (sceneElement instanceof NenyaImageSceneElement) {
        ((NenyaImageSceneElement) sceneElement).setColorList(tmp.toArray(new ClassedItem[0]));
      }
      if (sceneElement instanceof NenyaTileSceneElement) {
        ((NenyaTileSceneElement) sceneElement).setColorList(tmp.toArray(new ClassedItem[0]));
      }
      if (sceneElement instanceof NenyaComponentSceneElement) {
        ((NenyaComponentSceneElement) sceneElement)
            .getComponents()[itemList.getSelectedIndex()].setColorList(
                tmp.toArray(new ClassedItem[0]));
      }

      submitElement(sceneElement, null);
    } else {
      super.valueChanged(e);
    }
  }
  /*
   * The following method resets the window to its original status.
   */
  public void init() {
    sampleField.setText(new String("Big Java"));
    textField.setText(new String("Big Java"));

    facenameCombo.setSelectedIndex(0);
    sizeCombo.setSelectedIndex(2);

    italicCheckBox.setSelected(false);
    boldCheckBox.setSelected(false);

    //            largeButton.setSelected(true);

    fontColor = Color.BLACK;

    setSampleFont();
  } // end init method
Exemple #25
0
 /**
  * Get the selected AddeServer
  *
  * @return the server or null
  */
 private AddeServer getAddeServer() {
   Object selected = serverSelector.getSelectedItem();
   if ((selected != null) && (selected instanceof AddeServer)) {
     return (AddeServer) selected;
   }
   return null;
 }
  HeatMapControls(ControlBar creator) {
    super();
    parent = creator;

    setLayout(new BorderLayout());
    super.setPreferredSize(new Dimension(255, 170));

    String[] organisms = SpeciesTable.getOrganisms();
    String[] options = new String[organisms.length + 1];

    options[0] = "None";
    for (int i = 0; i < organisms.length; i++) {
      options[i + 1] = organisms[i];
    }

    species = new JComboBox(options);
    species.addActionListener(this);
    for (String str : SpeciesTable.getOrganisms()) {}

    super.add(species, BorderLayout.SOUTH);
    super.add(new Gradient(), BorderLayout.CENTER);
    super.add(new JLabel("Least"), BorderLayout.WEST);
    super.add(new JLabel("Most"), BorderLayout.EAST);
    super.add(new JLabel("Heat Map Controls"), BorderLayout.NORTH);
    super.setVisible(true);
  }
 public void actionPerformed(ActionEvent evt) {
   Object obj = evt.getSource();
   if (obj instanceof JMenuItem) {
     // put the focus on the noneditable combo.
     combo1.requestFocus();
   }
 }
  private JPanel createContentPane() {
    JPanel panel = new JPanel();

    combo1 = new JComboBox<>(numData);
    panel.add(combo1);
    combo2 = new JComboBox<>(dayData);
    combo2.setEditable(true);
    panel.add(combo2);
    panel.setSize(300, 200);

    popupMenu = new JPopupMenu();
    JMenuItem item;
    for (int i = 0; i < dayData.length; i++) {
      item = popupMenu.add(new JMenuItem(dayData[i], mnDayData[i]));
      item.addActionListener(this);
    }
    panel.addMouseListener(new PopupListener(popupMenu));

    JTextField field = new JTextField("CTRL+down for Popup");
    // CTRL-down will show the popup.
    field
        .getInputMap()
        .put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_MASK), "OPEN_POPUP");
    field.getActionMap().put("OPEN_POPUP", new PopupHandler());

    panel.add(field);

    return panel;
  }
 @Override
 public void onExit() {
   // save all painters
   for (EntryListPanel panel : listPanelSet) {
     myjava.gui.syntax.Painter painter = panel.getPainter();
     if (!painter.equals(myjava.gui.syntax.Painter.getDefaultInstance())) {
       myjava.gui.syntax.Painter.add(painter);
       setConfig("painter.userDefined." + painter.getName(), painter.toWritableString());
     }
     if (painter.equals(painterComboBox.getSelectedItem())) {
       // selected painter
       setConfig("syntax.selectedPainter", painter.getName());
       myjava.gui.syntax.Painter.setCurrentInstance(painter);
     }
   }
   // remove "removed painters"
   for (myjava.gui.syntax.Painter removed : removedPainters) {
     removeConfig0("painter.userDefined." + removed.getName());
     myjava.gui.syntax.Painter.remove(removed);
   }
   // highlight?
   boolean _highlightSyntax = highlightSyntax.isSelected();
   boolean _matchBracket = matchBracket.isSelected();
   MyUmbrellaLayerUI.setHighlightingStatus(_highlightSyntax, _matchBracket);
   setConfig("syntax.highlight", _highlightSyntax + "");
   setConfig("syntax.matchBrackets", _matchBracket + "");
 }
  /*
   *  I can't find any property on the scrollBar to determine if it will be
   *  displayed or not so use brute force to determine this.
   */
  protected int getScrollBarWidth(BasicComboPopup popup, JScrollPane scrollPane) {
    int scrollBarWidth = 0;
    JComboBox comboBox = (JComboBox) popup.getInvoker();

    if (comboBox.getItemCount() > comboBox.getMaximumRowCount()) {
      JScrollBar vertical = scrollPane.getVerticalScrollBar();
      scrollBarWidth = vertical.getPreferredSize().width;
    }

    return scrollBarWidth;
  }