private void addListener(final JComponent component) {
   if (component instanceof JComboBox) {
     ItemListener itemListener =
         new ItemListener() {
           public void itemStateChanged(ItemEvent e) {
             JComboBox comboBox = (JComboBox) component;
             final Object selectedItem = comboBox.getSelectedItem();
             _dotDefinitionDialogFrame
                 .getScratchDisplayObjectType()
                 .setValueOfStaticProperty(_primitiveForm.getName(), _property, selectedItem);
           }
         };
     JComboBox comboBox = (JComboBox) component;
     comboBox.addItemListener(itemListener);
   } else if (component instanceof JSpinner) {
     javax.swing.event.ChangeListener changeListener =
         new javax.swing.event.ChangeListener() {
           public void stateChanged(ChangeEvent e) {
             JSpinner spinner = (JSpinner) component;
             final Object value = spinner.getValue();
             _dotDefinitionDialogFrame
                 .getScratchDisplayObjectType()
                 .setValueOfStaticProperty(_primitiveForm.getName(), _property, value);
           }
         };
     JSpinner spinner = (JSpinner) component;
     spinner.addChangeListener(changeListener);
   }
 }
Exemple #2
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;
  }
 public String getValueForVisualization() {
   if (typeSelection.getSelectedItem().equals(MappingTypes.DATA_FIELD)) {
     return fieldSelection.getSelectedItem().toString();
   } else {
     return literalEntry.getText() + " (literal)";
   }
 }
  /*
   * 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
  public void go() {
    picture();
    ActionListener listener = new BtListener();
    go.addActionListener(listener);
    btn_update_manual.addActionListener(listener);
    go.setForeground(Color.black);
    // rights.setFont((new Font("Arial", Font.PLAIN, 12)));
    title.setFont((new Font("Arial", Font.BOLD, 36)));
    title.setForeground(new Color(238, 253, 253));
    today.setFont((new Font("Arial", Font.BOLD, 16)));
    today.setForeground(new Color(163, 184, 204));
    frame.setLayout(new BorderLayout());
    from.setBackground(Color.white);
    to.setBackground(Color.white);
    converted.setFont(new Font("Arial", Font.BOLD, 24));
    converted.setForeground(new Color(238, 253, 253));
    Lfrom.setForeground(new Color(238, 253, 253));
    Lto.setForeground(new Color(238, 253, 253));
    quantity.setForeground(new Color(238, 253, 253));
    Lfrom.setFont(new Font("Arial", Font.BOLD, 24));
    Lto.setFont(new Font("Arial", Font.BOLD, 24));
    quantity.setFont(new Font("Arial", Font.BOLD, 24));
    north.setLayout(new FlowLayout());
    north.add(title);
    north.setBackground(new Color(59, 62, 71));
    frame.add(BorderLayout.NORTH, north);
    inner.setLayout(new BorderLayout());
    inner.add(BorderLayout.NORTH, today);
    inner.add(BorderLayout.WEST, picPanel);
    center.setLayout(new GridLayout(2, 4, 5, 5));
    center.add(Lfrom);
    center.add(from);
    center.add(Lto);
    center.add(to);
    center.add(quantity);
    center.add(amount);
    center.add(go);
    inner.setBackground(new Color(59, 62, 71));
    inner.add(BorderLayout.SOUTH, center);
    center.setBackground(new Color(59, 62, 71));
    frame.add(BorderLayout.CENTER, inner);
    south.setBackground(new Color(59, 62, 71));
    south.setLayout(new FlowLayout());
    south.add(converted);
    south.add(answer);
    south.add(btn_update_manual);
    // south.add(rights);
    frame.add(BorderLayout.SOUTH, south);
    frame.setSize(850, 700);
    frame.setVisible(true);

    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent event) {
            frame.setVisible(false);
            frame.dispose();
            System.exit(0);
          }
        });
  }
  /** Used to find the global attributes that another inspector has set so I can share it. */
  ChartGenerator chartToUse(final String sName, Frame parent, final GUIState simulation) {
    Bag charts = new Bag();
    if (simulation.guiObjects != null)
      for (int i = 0; i < simulation.guiObjects.numObjs; i++)
        if (simulation.guiObjects.objs[i] instanceof ChartGenerator
            && validChartGenerator((ChartGenerator) (simulation.guiObjects.objs[i])))
          charts.add(simulation.guiObjects.objs[i]);
    if (charts.numObjs == 0) return createNewChart(simulation);

    // init the dialog panel
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());

    String[] chartNames = new String[charts.numObjs + 1];

    chartNames[0] = "[Create a New Chart]";
    for (int i = 0; i < charts.numObjs; i++)
      chartNames[i + 1] = ((ChartGenerator) (charts.objs[i])).getTitle();

    // add widgets
    JPanel panel2 = new JPanel();
    panel2.setLayout(new BorderLayout());
    panel2.setBorder(new javax.swing.border.TitledBorder("Plot on Chart..."));
    JComboBox encoding = new JComboBox(chartNames);
    panel2.add(encoding, BorderLayout.CENTER);
    p.add(panel2, BorderLayout.SOUTH);

    // ask
    if (JOptionPane.showConfirmDialog(
            parent, p, "Create a New Chart...", JOptionPane.OK_CANCEL_OPTION)
        != JOptionPane.OK_OPTION) return null;

    if (encoding.getSelectedIndex() == 0) return createNewChart(simulation);
    else return (ChartGenerator) (charts.objs[encoding.getSelectedIndex() - 1]);
  }
  public void display(ResultSet rs) {
    try {
      boolean recordNumber = rs.next();
      if (recordNumber) {
        payNo = rs.getString(1);
        pasNo = rs.getString(2);
        pasName = rs.getString(3);
        mode = rs.getString(4);
        dt = rs.getString(5);
        amount = rs.getString(6);
        rev = rs.getString(7);

        text1.setText(payNo);
        combo1.setSelectedItem(pasNo);
        combo2.setSelectedItem(pasName);
        combo4.setSelectedItem(mode);
        p_date.setText(dt);
        combo8.setSelectedItem(amount);
        combo3.setSelectedItem(rev);

      } else {
        JOptionPane.showMessageDialog(
            null, "Record Not found", "ERROR", JOptionPane.DEFAULT_OPTION);
      }
    } catch (SQLException sqlex) {
      sqlex.printStackTrace();
    }
  }
 private void stateChanged(ActionEvent event) {
   //        debug("state changed: " + (agents.getSelectedIndex() + 1) + ". item selected");
   if (agents.getSelectedIndex() + 1 == agents.getModel().getSize()) {
     //            debug("a new agent shall be created!");
     model.createNewAgent();
   } else model.reReadAgents();
 }
  @Override
  public JComponent createOptionsPanel() {
    final JFormattedTextField valueField = prepareNumberEditor("m_limit");
    final JComboBox comboBox =
        new ComboBox(
            new Object[] {Scope.NONE, Scope.PRIVATE, Scope.PACKAGE_LOCAL, Scope.PROTECTED});
    comboBox.setRenderer(
        new ListCellRendererWrapper() {
          @Override
          public void customize(
              JList list, Object value, int index, boolean selected, boolean hasFocus) {
            if (value instanceof Scope) setText(((Scope) value).getText());
          }
        });
    comboBox.setSelectedItem(ignoreScope);
    comboBox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            ignoreScope = (Scope) comboBox.getSelectedItem();
          }
        });
    comboBox.setPrototypeDisplayValue(Scope.PROTECTED);

    final FormBuilder formBuilder = FormBuilder.createFormBuilder();
    formBuilder.addLabeledComponent(getConfigurationLabel(), valueField);
    formBuilder.addLabeledComponent(
        InspectionGadgetsBundle.message("constructor.visibility.option"), comboBox);
    final JPanel panel = new JPanel(new BorderLayout());
    panel.add(formBuilder.getPanel(), BorderLayout.NORTH);
    return panel;
  }
 private void setUpBrowserCombobox() {
   for (BrowsersConfiguration.BrowserFamily family :
       BrowsersConfiguration.getInstance().getActiveBrowsers()) {
     browserComboBox.addItem(family);
   }
   browserComboBox.setRenderer(
       new ListCellRendererWrapper<BrowsersConfiguration.BrowserFamily>(browserComboBox) {
         @Override
         public void customize(
             JList list,
             BrowsersConfiguration.BrowserFamily family,
             int index,
             boolean selected,
             boolean hasFocus) {
           if (family != null) {
             setText(family.getName());
             setIcon(family.getIcon());
           }
         }
       });
   if (browserComboBox.getItemCount() < 2) {
     browserComboBox.setVisible(false);
     browserComboBox.setVisible(false);
   } else {
     browserComboBox.setSelectedItem(0);
   }
 }
  public DataSourceQueryChooserDialog(
      Collection dataSourceQueryChoosers, Frame frame, String title, boolean modal) {
    super(frame, title, modal);
    init(dataSourceQueryChoosers);
    try {
      jbInit();
      pack();
    } catch (Exception ex) {
      ex.printStackTrace();
    }
    addComponentListener(
        new ComponentAdapter() {
          public void componentShown(ComponentEvent e) {
            okCancelPanel.setOKPressed(false);
          }
        });
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            // User may have hit OK, got a validation-error dialog, then hit the
            // X button. [Jon Aquino]
            okCancelPanel.setOKPressed(false);
          }
        });

    // Set the selected item to trigger the event that sets the panel. [Jon Aquino]
    formatComboBox.setSelectedItem(formatComboBox.getItemAt(0));
  }
 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;
 }
  private void fillGUI() {
    Object[] attributes;
    boolean enabled;
    if (context != null) {
      attributes = this.context.getAttributes().toArray();
      enabled = true;
    } else {
      attributes = new Object[] {"No context available"};
      enabled = false;
    }

    sequenceColumnChooser.setModel(new DefaultComboBoxModel(attributes));
    sequenceColumnChooser.setEnabled(enabled);

    timelineColumnChooser.setModel(new DefaultComboBoxModel(attributes));
    timelineColumnChooser.setEnabled(enabled);
    if (context != null) {
      timelineColumnChooser.setSelectedIndex(Math.min(attributes.length - 1, 1));
    }

    calculateValueLists();
    fillSequenceChooser();

    setButtonStates(!enabled);
  }
  /**
   * Handles the various button clicking type activities.
   *
   * @param e a value of type 'ActionEvent'
   */
  public void actionPerformed(ActionEvent e) {

    if (e.getSource() == m_ConfigureBut) {
      selectProperty();
    } else if (e.getSource() == m_StatusBox) {
      // notify any listeners
      for (int i = 0; i < m_Listeners.size(); i++) {
        ActionListener temp = ((ActionListener) m_Listeners.elementAt(i));
        temp.actionPerformed(
            new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "Editor status change"));
      }

      // Toggles whether the custom property is used
      if (m_StatusBox.getSelectedIndex() == 0) {
        m_Exp.setUsePropertyIterator(false);
        m_ConfigureBut.setEnabled(false);
        m_ArrayEditor.setEnabled(false);
        m_ArrayEditor.setValue(null);
        validate();
      } else {
        if (m_Exp.getPropertyArray() == null) {
          selectProperty();
        }
        if (m_Exp.getPropertyArray() == null) {
          m_StatusBox.setSelectedIndex(0);
        } else {
          m_Exp.setUsePropertyIterator(true);
          m_ConfigureBut.setEnabled(true);
          m_ArrayEditor.setEnabled(true);
        }
        validate();
      }
    }
  }
  public SwingThreadFrame() {
    setTitle("SwingThreadTest");

    final JComboBox combo = new JComboBox();
    combo.insertItemAt(new Integer(Integer.MAX_VALUE), 0);
    combo.setPrototypeDisplayValue(combo.getItemAt(0));
    combo.setSelectedIndex(0);

    JPanel panel = new JPanel();

    JButton goodButton = new JButton("Good");
    goodButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            new Thread(new GoodWorkerRunnable(combo)).start();
          }
        });
    panel.add(goodButton);
    JButton badButton = new JButton("Bad");
    badButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            new Thread(new BadWorkerRunnable(combo)).start();
          }
        });
    panel.add(badButton);
    panel.add(combo);
    add(panel);
    pack();
  }
  private void setupAttributes() {
    Color frameColor = (Color) AttributeFigure.getDefaultAttribute("FrameColor");
    Color fillColor = (Color) AttributeFigure.getDefaultAttribute("FillColor");
    Color textColor = (Color) AttributeFigure.getDefaultAttribute("TextColor");
    Integer arrowMode = (Integer) AttributeFigure.getDefaultAttribute("ArrowMode");
    String fontName = (String) AttributeFigure.getDefaultAttribute("FontName");

    FigureEnumeration k = view().selectionElements();
    while (k.hasMoreElements()) {
      Figure f = k.nextFigure();
      frameColor = (Color) f.getAttribute("FrameColor");
      fillColor = (Color) f.getAttribute("FillColor");
      textColor = (Color) f.getAttribute("TextColor");
      arrowMode = (Integer) f.getAttribute("ArrowMode");
      fontName = (String) f.getAttribute("FontName");
    }

    fFrameColor.setSelectedIndex(ColorMap.colorIndex(frameColor));
    fFillColor.setSelectedIndex(ColorMap.colorIndex(fillColor));
    // fTextColor.select(ColorMap.colorIndex(textColor));
    if (arrowMode != null) {
      fArrowChoice.setSelectedIndex(arrowMode.intValue());
    }
    if (fontName != null) {
      fFontChoice.setSelectedItem(fontName);
    }
  }
  private void init() {
    agents = new JComboBox(model);
    agents.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            stateChanged(event);
          }
        });
    agents.addActionListener(TextChangesListener.getInstance());
    ctm = new CreationTableModel();
    datatable = new JTable(ctm);
    datatable.setShowGrid(false);
    datatable.setEnabled(false);
    datatable.setTableHeader(null);
    datatable.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 3));
    JPanel apanel = new JPanel(new BorderLayout());
    apanel.add(new JLabel("Who took the photo: "), BorderLayout.WEST);
    apanel.add(agents, BorderLayout.CENTER);
    JPanel tablePanel = new JPanel(new BorderLayout());
    tablePanel.add(new JScrollPane(datatable), BorderLayout.CENTER);

    datatable.getColumnModel().getColumn(0).setMaxWidth(120);
    datatable.getColumnModel().getColumn(0).setMinWidth(80);

    datatable.addKeyListener(TextChangesListener.getInstance());

    this.add(
        ComponentFactory.createTitledPanel("Creator of the image:", apanel), BorderLayout.NORTH);
    this.add(
        ComponentFactory.createTitledPanel("Creation, EXIF & technical information:", tablePanel),
        BorderLayout.CENTER);
    this.add(new JSeparator(JSeparator.HORIZONTAL), BorderLayout.WEST);
  }
  public boolean checkSettings() {
    if (!new File(downloadDirectoryTextField.getText()).exists()) {
      JOptionPane.showMessageDialog(
          this,
          I18n.getLocaleString("INVALID_DOWNLOAD_DIRECTORY"),
          I18n.getLocaleString("ERROR"),
          JOptionPane.ERROR_MESSAGE);
      return false;
    }

    if (!Groovesquid.getDownloadService()
        .getFilenameSchemeParser()
        .validateFilenameScheme(fileNameSchemeTextField.getText())) {
      JOptionPane.showMessageDialog(
          this,
          I18n.getLocaleString("INVALID_FILENAME_SCHEME"),
          I18n.getLocaleString("ERROR"),
          JOptionPane.ERROR_MESSAGE);
      return false;
    }

    return !((downloadCompletedComboBox.getSelectedIndex()
                == Config.DownloadComplete.ADD_ITUNES.ordinal()
            || downloadCompletedComboBox.getSelectedIndex()
                == Config.DownloadComplete.ADD_ITUNES_REMOVE.ordinal())
        && !GuiUtils.getSystem().equals(GuiUtils.OperatingSystem.MAC));
  }
  public Element createXML() {
    if (agents.getSelectedIndex() + 1 < agents.getModel().getSize()) {
      Element e = (Element) AgentComboBoxModel.getAgents().get(agents.getSelectedIndex());
      Vector settings = new Vector();
      // Eigenschaften ab 7 werden als Settings fürs Tool ausgelesen (EXIF-Tags) :)
      // ist keines gesetzt, so wird der Vector wieder auf null gesetzt :)
      boolean atLeastOneSettingDefined = false;
      Iterator itVals = ctm.getValues().iterator();
      int tempCount = 0;
      for (Object o : ctm.getKeys()) {
        String tempKey = (String) o;
        String tempVal = (String) itVals.next();
        if (tempVal.length() > 0
            && tempCount > 5) { // Wenn Wert da und wenns keiner der ersten 6 std werte is
          settings.add(tempKey + "=" + tempVal);
          atLeastOneSettingDefined = true;
        }
        tempCount++;
      }
      if (!atLeastOneSettingDefined) settings = null;
      String time = null;
      if (datatable.getValueAt(0, 1).toString().length() > 0)
        time = datatable.getValueAt(0, 1).toString();

      String tool = null;
      int count = 0;
      for (Object o1 : ctm.getKeys()) {
        String s = (String) o1;
        if (s.equals("Make")) {
          if (tool == null) tool = new String();
          tool = ctm.getValues().get(count) + " " + tool;
        }
        if (s.equals("Model")) {
          if (tool == null) tool = new String();
          tool = tool + ctm.getValues().get(count);
        }
        count++;
      }
      Mpeg7CreationInformation m7ci = new Mpeg7CreationInformation(e, tool, settings, time);
      // Getting data ....
      String bits = null, fformat = null, fsize = null, ih = null, iw = null;
      if (datatable.getValueAt(1, 1).toString().length() > 0)
        fformat = datatable.getValueAt(1, 1).toString();
      if (datatable.getValueAt(2, 1).toString().length() > 0)
        fsize = datatable.getValueAt(2, 1).toString();
      if (datatable.getValueAt(4, 1).toString().length() > 0)
        ih = datatable.getValueAt(4, 1).toString();
      if (datatable.getValueAt(3, 1).toString().length() > 0)
        iw = datatable.getValueAt(3, 1).toString();
      if (datatable.getValueAt(5, 1).toString().length() > 0)
        bits = datatable.getValueAt(5, 1).toString();
      Mpeg7MediaFormat m7mf = new Mpeg7MediaFormat(bits, fformat, fsize, ih, iw);
      Element mediaFormat = m7mf.createDocument();
      Element ret = new Element("return", mediaFormat.getNamespace()).addContent(mediaFormat);
      ret.addContent(m7ci.createDocument().detach());
      return ret;
    } else {
      return null;
    }
  }
    public void layoutContainer(Container parent) {
      JComboBox cb = (JComboBox) parent;

      // Use superclass behavior if the combobox is not editable.
      if (!cb.isEditable()) {
        super.layoutContainer(parent);
        return;
      }

      int width = cb.getWidth();
      int height = cb.getHeight();

      Insets insets = getInsets();
      int buttonWidth = getEditableButtonWidth();
      int buttonHeight = height - (insets.top + insets.bottom);

      if (arrowButton != null) {
        if (cb.getComponentOrientation().isLeftToRight()) {
          arrowButton.setBounds(
              width - (insets.right + buttonWidth), insets.top, buttonWidth, buttonHeight);
        } else {
          arrowButton.setBounds(insets.left, insets.top, buttonWidth, buttonHeight);
        }
      }
      if (editor != null) {
        editor.setBounds(rectangleForCurrentValue());
      }
    }
Exemple #21
0
  private void jButton1ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed
    // TODO add your handling code here:
    boolean status = socket.getstatus();
    if (users.getSelectedIndex() == 0) {
      JOptionPane.showMessageDialog(
          null, "No user selected", "Status message", JOptionPane.INFORMATION_MESSAGE);
    } else {

      if (status) {
        JOptionPane.showMessageDialog(
            null,
            "The device is already powered on",
            "Status message",
            JOptionPane.INFORMATION_MESSAGE);
      } else {
        socket.turnOn();
        Icon theIcon = new ImageIcon(gui.class.getResource("images/on.png"));
        jLabel4.setIcon(theIcon);
        System.out.println(
            "Manual override by "
                + userStrings[users.getSelectedIndex()]
                + " at "
                + getDateTime()
                + ", feeling: "
                + labels[jSlider1.getValue()]);
      }
    }
  } // GEN-LAST:event_jButton1ActionPerformed
  public Mapper() {
    super("Action/Input Mapper");
    setSize(500, 600);
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    JPanel setupPane = new JPanel(new GridLayout(0, 1));
    JPanel classPane = new JPanel(new BorderLayout());
    classPane.add(new JLabel("Class: "), BorderLayout.WEST);
    classPane.add(nameF, BorderLayout.CENTER);
    classPane.add(stateC, BorderLayout.EAST);
    JPanel mapPane = new JPanel();
    mapPane.add(inputB);
    mapPane.add(actionB);
    mapPane.add(bindingB);

    setupPane.add(classPane);
    setupPane.add(mapPane);

    getContentPane().add(setupPane, BorderLayout.NORTH);
    getContentPane().add(new JScrollPane(results), BorderLayout.CENTER);

    nameF.addActionListener(this);
    stateC.addActionListener(this);
    stateC.setEditable(false);
    new Probe().loadAudioActions(); // !!!
    setVisible(true);
  }
Exemple #23
0
 public void syncPanel() {
   panelPat.syncPanel();
   regionAButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.A);
   regionBButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.B);
   regionCButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.C);
   elevBox.setText(dlg.panelMain.mark.getElevation());
   heightBox.setText(dlg.panelMain.mark.getObjectHeight());
   sourceBox.setText(dlg.panelMain.mark.getSource());
   infoBox.setText(dlg.panelMain.mark.getInfo());
   for (Sts sts : statuses.keySet()) {
     int item = statuses.get(sts);
     if (dlg.panelMain.mark.getStatus() == sts) statusBox.setSelectedIndex(item);
   }
   for (Cns cns : constructions.keySet()) {
     int item = constructions.get(cns);
     if (dlg.panelMain.mark.getConstr() == cns) constrBox.setSelectedIndex(item);
   }
   for (Con con : conspicuities.keySet()) {
     int item = conspicuities.get(con);
     if (dlg.panelMain.mark.getConsp() == con) conBox.setSelectedIndex(item);
   }
   for (Con con : reflectivities.keySet()) {
     int item = reflectivities.get(con);
     if (dlg.panelMain.mark.getRefl() == con) reflBox.setSelectedIndex(item);
   }
 }
Exemple #24
0
 private void setupAttributes() {
   Color frameColor =
       (Color) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FRAME_COLOR);
   Color fillColor =
       (Color) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FILL_COLOR);
   Integer arrowMode =
       (Integer) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.ARROW_MODE);
   String fontName =
       (String) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FONT_NAME);
   FigureEnumeration fe = view().selection();
   while (fe.hasNextFigure()) {
     Figure f = fe.nextFigure();
     frameColor = (Color) f.getAttribute(FigureAttributeConstant.FRAME_COLOR);
     fillColor = (Color) f.getAttribute(FigureAttributeConstant.FILL_COLOR);
     arrowMode = (Integer) f.getAttribute(FigureAttributeConstant.ARROW_MODE);
     fontName = (String) f.getAttribute(FigureAttributeConstant.FONT_NAME);
   }
   fFrameColor.setSelectedIndex(ColorMap.colorIndex(frameColor));
   fFillColor.setSelectedIndex(ColorMap.colorIndex(fillColor));
   if (arrowMode != null) {
     fArrowChoice.setSelectedIndex(arrowMode.intValue());
   }
   if (fontName != null) {
     fFontChoice.setSelectedItem(fontName);
   }
 }
  @Override
  public JComponent createForm() {

    JComponent component = super.createForm();

    annotationComboBox.setRenderer(
        new DefaultListCellRenderer() {
          @Override
          public Component getListCellRendererComponent(
              JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            if (value != null) {
              Annotation annotation = (Annotation) value;
              this.setText(annotation.getBrief());
            } else {
              this.setText("-- select annotation --");
            }
            return this;
          }
        });

    component.setLayout(new FormLayout("right:p, 4dlu, left:p", "p, 4dlu, p, 4dlu, p, 4dlu, p"));

    CellConstraints cc = new CellConstraints();

    component.add(getLabel("annotationLabel"), cc.xy(1, 1));
    component.add(annotationComboBox, cc.xy(3, 1));
    component.add(getLabel("patternLabel"), cc.xy(1, 3));
    component.add(patternField, cc.xy(3, 3));
    component.add(getLabel("ciLabel"), cc.xy(1, 5));
    component.add(caseInsensitive, cc.xy(3, 5));
    component.add(getLabel("remove"), cc.xy(1, 7));
    component.add(removeMatched, cc.xy(3, 7));

    patternField.setEnabled(false);
    caseInsensitive.setSelected(true);
    caseInsensitive.setEnabled(false);

    // action listener will fill out a suggested pattern for selected annotation types
    annotationComboBox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            Object obj = annotationComboBox.getSelectedItem();
            if (obj == null) {
              patternField.setEnabled(false);
              caseInsensitive.setEnabled(false);
              setEnabled(false);
            } else {
              patternField.setEnabled(true);
              caseInsensitive.setEnabled(true);
              patternField.setText(getDefault(obj.getClass()));
              patternField.setCaretPosition(0);
              setEnabled(true);
            }
          }
        });

    return component;
  }
  public TableCellRenderFrame() {
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    TableModel model = new PlanetTableModel();
    JTable table = new JTable(model);
    table.setRowSelectionAllowed(false);

    // set up renderers and editors

    table.setDefaultRenderer(Color.class, new ColorTableCellRenderer());
    table.setDefaultEditor(Color.class, new ColorTableCellEditor());

    JComboBox<Integer> moonCombo = new JComboBox<>();
    for (int i = 0; i <= 20; i++) moonCombo.addItem(i);

    TableColumnModel columnModel = table.getColumnModel();
    TableColumn moonColumn = columnModel.getColumn(PlanetTableModel.MOONS_COLUMN);
    moonColumn.setCellEditor(new DefaultCellEditor(moonCombo));
    moonColumn.setHeaderRenderer(table.getDefaultRenderer(ImageIcon.class));
    moonColumn.setHeaderValue(new ImageIcon(getClass().getResource("Moons.gif")));

    // show table

    table.setRowHeight(100);
    add(new JScrollPane(table), BorderLayout.CENTER);
  }
 public String getValueEntered() {
   if (typeSelection.getSelectedItem().equals(MappingTypes.DATA_FIELD)) {
     return "<<" + fieldSelection.getSelectedIndex() + ">>";
   } else {
     return literalEntry.getText();
   }
 }
  @Override
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == imageView) {
      selectedView = imageView.getSelectedIndex();
      owner.viewUpdated();
    } else if (e.getSource() == showCorners) {
      bShowCorners = showCorners.isSelected();
      owner.viewUpdated();
    } else if (e.getSource() == showLines) {
      bShowLines = showLines.isSelected();
      owner.viewUpdated();
    } else if (e.getSource() == showContour) {
      bShowContour = showContour.isSelected();
      owner.viewUpdated();
    } else if (e.getSource() == refineChoice) {
      refineType = PolygonRefineType.values()[refineChoice.getSelectedIndex()];

      updateRefineSettings();
      owner.configUpdate();
    } else if (e.getSource() == setConvex) {
      config.convex = setConvex.isSelected();
      owner.configUpdate();
    } else if (e.getSource() == setBorder) {
      config.convex = setBorder.isSelected();
      owner.configUpdate();
    }
  }
 public void disableEnableComponents(boolean disable) {
   typeSelection.setEnabled(disable);
   fieldSelection.setEnabled(disable);
   fieldDrop.setEnabled(disable);
   literalEntry.setEnabled(disable);
   addRemoveMappingChoice.setEnabled(disable);
 }
Exemple #30
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();
  }