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);
   }
 }
Example #2
0
  private MainPanel() {
    super(new BorderLayout());
    StringBuffer buf = new StringBuffer();
    for (int i = 0; i < 100; i++) {
      String s = i + LF;
      buf.append(s);
    }

    final JScrollPane scrollPane = new JScrollPane(new JTextArea(buf.toString()));
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

    JSpinner spinner =
        new JSpinner(
            new SpinnerNumberModel(
                scrollPane.getVerticalScrollBar().getUnitIncrement(1), 1, 100000, 1));
    spinner.setEditor(new JSpinner.NumberEditor(spinner, "#####0"));
    spinner.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            JSpinner s = (JSpinner) e.getSource();
            scrollPane.getVerticalScrollBar().setUnitIncrement((Integer) s.getValue());
          }
        });
    Box box = Box.createHorizontalBox();
    box.add(new JLabel("Unit Increment:"));
    box.add(Box.createHorizontalStrut(2));
    box.add(spinner);
    box.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    add(box, BorderLayout.NORTH);
    add(scrollPane);
    setPreferredSize(new Dimension(320, 240));
  }
  public void apply() {
    if (!isModified()) return;

    final ScalaProjectSettings scalaProjectSettings = ScalaProjectSettings.getInstance(myProject);
    scalaProjectSettings.setImplicitParametersSearchDepth(
        (Integer) implicitParametersSearchDepthSpinner.getValue());
    scalaProjectSettings.setOutputLimit((Integer) outputSpinner.getValue());
    scalaProjectSettings.setInProcessMode(runWorksheetInTheCheckBox.isSelected());
    scalaProjectSettings.setInteractiveMode(worksheetInteractiveModeCheckBox.isSelected());

    scalaProjectSettings.setSearchAllSymbols(searchAllSymbolsIncludeCheckBox.isSelected());
    scalaProjectSettings.setEnableJavaToScalaConversion(
        enableConversionOnCopyCheckBox.isSelected());
    scalaProjectSettings.setDontShowConversionDialog(donTShowDialogCheckBox.isSelected());
    scalaProjectSettings.setTreatDocCommentAsBlockComment(
        treatDocCommentAsBlockComment.isSelected());

    scalaProjectSettings.setShowImplisitConversions(showImplicitConversionsInCheckBox.isSelected());
    scalaProjectSettings.setShowArgumentsToByNameParams(
        showArgumentsToByNameParametersCheckBox.isSelected());
    scalaProjectSettings.setIncludeBlockExpressions(
        includeBlockExpressionsExpressionsCheckBox.isSelected());
    scalaProjectSettings.setIncludeLiterals(includeLiteralsCheckBox.isSelected());

    scalaProjectSettings.setIgnorePerformance(myResolveToAllClassesCheckBox.isSelected());
    scalaProjectSettings.setDisableLangInjection(myDisableLanguageInjection.isSelected());
    scalaProjectSettings.setDisableI18N(myDisablei18n.isSelected());
    scalaProjectSettings.setDontCacheCompoundTypes(myDontCacheCompound.isSelected());
    scalaProjectSettings.setScalaPriority(useScalaClassesPriorityCheckBox.isSelected());
    scalaProjectSettings.setCollectionTypeHighlightingLevel(
        collectionHighlightingChooser.getSelectedIndex());
    injectionPrefixTable.saveSettings(scalaProjectSettings);
  }
Example #4
0
    public void stateChanged(ChangeEvent e) {
      JSpinner source = (JSpinner) e.getSource();
      if (source.getName().equals("Hour")) {
        calendar.set(Calendar.HOUR_OF_DAY, getSelectedHour());
        return;
      }
      if (source.getName().equals("Year")) {

        calendar.set(Calendar.YEAR, getSelectedYear());
        dayPanel.removeAll();
        this.flushWeekAndDayPanal(calendar);
        dayPanel.revalidate();
        dayPanel.updateUI();
        return;
      }
      if (source.getName().equals("Month")) {
        calendar.set(Calendar.MONTH, getSelectedMonth() - 1);

        dayPanel.removeAll();
        this.flushWeekAndDayPanal(calendar);
        dayPanel.revalidate();
        dayPanel.updateUI();
        return;
      }
    }
 private void loadFloor() {
   if (currentFloor == null) return;
   isLoading = true;
   blendingCheckbox.setSelected(currentFloor.occlude);
   switch (previewBox.getMode()) {
     case RT3_GAME:
       gameColour.setColour(currentFloor.colour2);
       gameTexture.setValue(currentFloor.texture);
       gameName.setText(currentFloor.name);
       break;
     case RT3_MAP:
       gameColour.setColour(currentFloor.minimapColour);
       gameTexture.setValue(currentFloor.texture);
       gameName.setText(currentFloor.name);
       break;
     case RT4P_OVERLAY:
       gameColour.setColour(currentFloor.hdColour);
       gameTexture.setValue(currentFloor.hdTexture);
       // gameName.setText(currentFloor.name);
       break;
     case RT4P_UNDERLAY:
       gameColour.setColour(currentFloor.hdUlColour);
       gameTexture.setValue(currentFloor.hdUlTexture);
       // gameName.setText(currentFloor.name);
       break;
   }
   isLoading = false;
   previewBox.repaint();
 }
  private void setEnableStatusOfUseProxy(boolean enableStatus) {
    httpLabel.setEnabled(enableStatus);
    httpsLabel.setEnabled(enableStatus);
    ftpLabel.setEnabled(enableStatus);

    proxyAddressLabel.setEnabled(enableStatus);
    proxyPortLabel.setEnabled(enableStatus);
    proxyUserNameLabel.setEnabled(enableStatus);
    proxyPasswordLabel.setEnabled(enableStatus);
    httpProxyAddressTextField.setEnabled(enableStatus);
    httpProxyPortSpinner.setEnabled(enableStatus);
    httpProxyUserNameTextField.setEnabled(enableStatus);
    httpProxyPasswordField.setEnabled(enableStatus);

    httpsProxyAddressTextField.setEnabled(enableStatus);
    httpsProxyPortSpinner.setEnabled(enableStatus);
    httpsProxyUserNameTextField.setEnabled(enableStatus);
    httpsProxyPasswordField.setEnabled(enableStatus);

    ftpProxyAddressTextField.setEnabled(enableStatus);
    ftpProxyPortSpinner.setEnabled(enableStatus);
    ftpProxyUserNameTextField.setEnabled(enableStatus);
    ftpProxyPasswordField.setEnabled(enableStatus);

    socksLabel.setEnabled(!enableStatus);

    socksProxyAddressLabel.setEnabled(!enableStatus);
    socksProxyPortLabel.setEnabled(!enableStatus);
    socksProxyUserNameLabel.setEnabled(!enableStatus);
    socksProxyPasswordLabel.setEnabled(!enableStatus);
    socksProxyAddressTextField.setEnabled(!enableStatus);
    socksProxyPortSpinner.setEnabled(!enableStatus);
    socksProxyUserNameTextField.setEnabled(!enableStatus);
    socksProxyPasswordField.setEnabled(!enableStatus);
  }
 @Override
 public void reset() {
   VcsContentAnnotationSettings settings = VcsContentAnnotationSettings.getInstance(myProject);
   myHighlightRecentlyChanged.setSelected(settings.isShow());
   myHighlightInterval.setValue(settings.getLimitDays());
   myHighlightInterval.setEnabled(myHighlightRecentlyChanged.isSelected());
 }
  /** Performs the action of loading a session from a file. */
  public void actionPerformed(ActionEvent e) {
    DataModel dataModel = getDataEditor().getSelectedDataModel();

    if (!(dataModel instanceof DataSet)) {
      JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Must be a tabular data set.");
      return;
    }

    this.dataSet = (DataSet) dataModel;

    SpinnerNumberModel spinnerNumberModel = new SpinnerNumberModel(getNumLags(), 0, 20, 1);
    JSpinner jSpinner = new JSpinner(spinnerNumberModel);
    jSpinner.setPreferredSize(jSpinner.getPreferredSize());

    spinnerNumberModel.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            SpinnerNumberModel model = (SpinnerNumberModel) e.getSource();
            setNumLags(model.getNumber().intValue());
          }
        });

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());

    Box b = Box.createVerticalBox();
    Box b1 = Box.createHorizontalBox();
    b1.add(new JLabel("Number of time lags: "));
    b1.add(Box.createHorizontalGlue());
    b1.add(Box.createHorizontalStrut(15));
    b1.add(jSpinner);
    b1.setBorder(new EmptyBorder(10, 10, 10, 10));
    b.add(b1);

    panel.add(b, BorderLayout.CENTER);

    EditorWindow editorWindow = new EditorWindow(panel, "Create time series data", "Save", true);
    DesktopController.getInstance().addEditorWindow(editorWindow);
    editorWindow.setVisible(true);

    editorWindow.addInternalFrameListener(
        new InternalFrameAdapter() {
          public void internalFrameClosed(InternalFrameEvent e) {
            EditorWindow window = (EditorWindow) e.getSource();

            if (!window.isCanceled()) {
              if (dataSet.isContinuous()) {
                createContinuousTimeSeriesData();
              } else if (dataSet.isDiscrete()) {
                createDiscreteTimeSeriesData();
              } else {
                JOptionPane.showMessageDialog(
                    JOptionUtils.centeringComp(),
                    "Data set must be either continuous or discrete.");
              }
            }
          }
        });
  }
  public SpinnerModelEditorDemo() {
    // Group labels
    JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayout(4, 1));
    panel1.add(new JLabel("Date"));
    panel1.add(new JLabel("Day"));
    panel1.add(new JLabel("Month"));
    panel1.add(new JLabel("Year"));

    // Group spinners
    JPanel panel2 = new JPanel();
    panel2.setLayout(new GridLayout(4, 1));
    panel2.add(jspDate);
    panel2.add(jspDay);
    panel2.add(jspMonth);
    panel2.add(spinnerYear);

    // Add spinner and label to the UI
    add(panel1, BorderLayout.WEST);
    add(panel2, BorderLayout.CENTER);

    // Set editor for date
    JSpinner.DateEditor dateEditor = new JSpinner.DateEditor(jspDate, "MMM dd, yyyy");
    jspDate.setEditor(dateEditor);

    // Set editor for year
    JSpinner.NumberEditor yearEditor = new JSpinner.NumberEditor(spinnerYear, "####");
    spinnerYear.setEditor(yearEditor);

    // Update date to synchronize with the day, month, and year
    updateDate();

    // Register and create a listener for jspDay
    jspDay.addChangeListener(
        new ChangeListener() {
          public void stateChanged(javax.swing.event.ChangeEvent e) {
            updateDate();
          }
        });

    // Register and create a listener for jspMonth
    jspMonth.addChangeListener(
        new ChangeListener() {
          public void stateChanged(javax.swing.event.ChangeEvent e) {
            updateDate();
          }
        });

    // Register and create a listener for spinnerYear
    spinnerYear.addChangeListener(
        new ChangeListener() {
          public void stateChanged(javax.swing.event.ChangeEvent e) {
            updateDate();
          }
        });
  }
Example #10
0
  private void onOK() {
    System.out.println("pase por aqui");
    int tamanyHidato = (int) spinnerTamanyHidato.getValue();
    int forats = (int) spinnerForats.getValue();
    int numerosPrecolocats = (int) spinnerNumerosPrecolocats.getValue();
    String dificultat = (String) comboBoxDificultat.getSelectedItem();

    ControladorHidato.fesCreacioAutomatica(tamanyHidato, forats, numerosPrecolocats, dificultat);
    dispose();
  }
Example #11
0
  /**
   * Méthode de création du panelInit
   *
   * @return
   */
  private JPanel createPanelInit() {

    JPanel panRight = new JPanel();
    panRight.setLayout(new BoxLayout(panRight, BoxLayout.Y_AXIS));

    butListParty = new JButton("Liste des parties");
    butListParty.addActionListener(this);

    JPanel panCreate = new JPanel();
    panCreate.setLayout(new BoxLayout(panCreate, BoxLayout.X_AXIS));
    textCreate = new JTextField("", 40);
    textCreate.setMaximumSize(textCreate.getPreferredSize());
    butCreateParty = new JButton("Creation de parties ");
    butCreateParty.addActionListener(this);
    SpinnerModel model = new SpinnerNumberModel(3, 2, 8, 1);
    spinNbPlayer = new JSpinner(model);
    spinNbPlayer.setMaximumSize(spinNbPlayer.getPreferredSize());
    panCreate.add(new JLabel("Nouveau nom de partie : "));
    panCreate.add(textCreate);
    panCreate.add(Box.createHorizontalStrut(20));
    panCreate.add(new JLabel("Nombres de joueurs : "));
    panCreate.add(spinNbPlayer);
    panCreate.add(butCreateParty);

    JPanel panJoin = new JPanel();
    panJoin.setLayout(new BoxLayout(panJoin, BoxLayout.X_AXIS));
    textJoin = new JTextField("", 2);
    textJoin.setMaximumSize(textJoin.getPreferredSize());
    butJoinParty = new JButton("Rejoindre la partie ");
    butJoinParty.addActionListener(this);
    panJoin.add(new JLabel("Num Partie : "));
    panJoin.add(textJoin);
    panJoin.add(butJoinParty);

    panRight.add(butListParty);
    panRight.add(panCreate);
    panRight.add(panJoin);
    panRight.add(Box.createVerticalGlue());

    textInfoInit = new JTextArea(20, 100);
    textInfoInit.setLineWrap(true);

    JScrollPane scroll =
        new JScrollPane(
            textInfoInit,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    JPanel panAll = new JPanel();
    panAll.setLayout(new BoxLayout(panAll, BoxLayout.X_AXIS));
    panAll.add(scroll);
    panAll.add(panRight);

    return panAll;
  }
 private void configureSpinnerFloat(JSpinner spinner) {
   JSpinner.NumberEditor editor = (JSpinner.NumberEditor) spinner.getEditor();
   DecimalFormat format = editor.getFormat();
   format.setMinimumFractionDigits(3);
   format.setMinimumIntegerDigits(1);
   editor.getTextField().setHorizontalAlignment(SwingConstants.CENTER);
   Dimension d = spinner.getPreferredSize();
   d.width = 60;
   spinner.setPreferredSize(d);
   spinner.addChangeListener(this);
   spinner.setMaximumSize(d);
 }
  @SuppressWarnings({"ConstantConditions", "RedundantIfStatement"})
  public boolean isModified() {

    final ScalaProjectSettings scalaProjectSettings = ScalaProjectSettings.getInstance(myProject);

    if (scalaProjectSettings.isShowImplisitConversions()
        != showImplicitConversionsInCheckBox.isSelected()) return true;
    if (scalaProjectSettings.isShowArgumentsToByNameParams()
        != showArgumentsToByNameParametersCheckBox.isSelected()) return true;
    if (scalaProjectSettings.isIncludeBlockExpressions()
        != includeBlockExpressionsExpressionsCheckBox.isSelected()) return true;
    if (scalaProjectSettings.isIncludeLiterals() != includeLiteralsCheckBox.isSelected())
      return true;

    if (scalaProjectSettings.getImplicitParametersSearchDepth()
        != (Integer) implicitParametersSearchDepthSpinner.getValue()) return true;
    if (scalaProjectSettings.getOutputLimit() != (Integer) outputSpinner.getValue()) return true;
    if (scalaProjectSettings.isInProcessMode() != runWorksheetInTheCheckBox.isSelected())
      return true;
    if (scalaProjectSettings.isInteractiveMode() != worksheetInteractiveModeCheckBox.isSelected())
      return true;

    if (scalaProjectSettings.isSearchAllSymbols() != searchAllSymbolsIncludeCheckBox.isSelected())
      return true;
    if (scalaProjectSettings.isEnableJavaToScalaConversion()
        != enableConversionOnCopyCheckBox.isSelected()) return true;
    if (scalaProjectSettings.isDontShowConversionDialog() != donTShowDialogCheckBox.isSelected())
      return true;
    if (scalaProjectSettings.isTreatDocCommentAsBlockComment()
        != treatDocCommentAsBlockComment.isSelected()) return true;

    if (scalaProjectSettings.isIgnorePerformance() != myResolveToAllClassesCheckBox.isSelected())
      return true;

    if (scalaProjectSettings.isDisableLangInjection() != myDisableLanguageInjection.isSelected())
      return true;

    if (scalaProjectSettings.isDisableI18N() != myDisablei18n.isSelected()) return true;

    if (scalaProjectSettings.isDontCacheCompoundTypes() != myDontCacheCompound.isSelected())
      return true;

    if (scalaProjectSettings.isScalaPriority() != useScalaClassesPriorityCheckBox.isSelected())
      return true;

    if (scalaProjectSettings.getCollectionTypeHighlightingLevel()
        != collectionHighlightingChooser.getSelectedIndex()) return true;

    if (injectionPrefixTable.isModified(scalaProjectSettings)) return true;

    return false;
  }
 /** Saves event into the list. */
 public synchronized void save() {
   myEvent.setNEID(myNE.getId());
   myEvent.setEnabled(true);
   myEvent.setDescription(desc.getText());
   int h = (Integer) hh.getValue();
   int m = (Integer) mm.getValue();
   double s = (Double) ss.getValue();
   myEvent.setTime(h + (m / 60.0) + (s / 3600.0));
   myEventManager.clearEvent(myEvent);
   myEventManager.addEvent(myEvent);
   if (eventTable != null) eventTable.updateData();
   return;
 }
  /** Set the time spinner's font. */
  protected void setupTimeFont() {
    Font font;
    if (spinner == null) return;

    // If not null, use what the user gave us

    if (timeFont != null) {
      spinner.setFont(timeFont);
    } else {
      font = UIManager.getFont("Spinner.font");
      spinner.setFont(font);
    }
  }
 private void onSemesterSelected() {
   LOGGER.trace(
       "KurseSemesterwahlController Event Semester selected =" + spinnerSemester.getValue());
   boolean equalFieldAndModelValue =
       equalsNullSafe(spinnerSemester.getValue(), kurseSemesterwahlModel.getSemester());
   setModelSemester();
   if (equalFieldAndModelValue && isModelValidationMode()) {
     // Wenn Field und Model den gleichen Wert haben, erfolgt kein PropertyChangeEvent. Deshalb
     // muss hier die Validierung angestossen werden.
     LOGGER.trace("Validierung wegen equalFieldAndModelValue");
     validate();
   }
 }
Example #17
0
  public NewGameDialog(GUI parent) {
    this.parent = parent;
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.setTitle("New game");
    this.setSize(250, 150);
    this.setResizable(false);
    this.setLocationRelativeTo(null);
    JPanel contentPane = new JPanel();
    this.add(contentPane);
    contentPane.setLayout(new FlowLayout()); // BoxLayout(contentPane, BoxLayout.PAGE_AXIS));

    SpinnerNumberModel model = new SpinnerNumberModel(1, 1, 3, 1);
    JLabel numAIlabel = new JLabel("Number of opponents:");
    numAIlabel.setMaximumSize(numAIlabel.getPreferredSize());
    contentPane.add(numAIlabel);

    numAI = new JSpinner(model); /*{
            @Override
            public Dimension getMaximumSize() {
                Dimension dim = super.getMaximumSize();
                dim.height = getPreferredSize().height;
                return dim;
            }
        };*/
    numAI.setEditor(new JSpinner.DefaultEditor(numAI));
    numAI.setPreferredSize(new Dimension(100, 30));

    // numAI.setMaximumSize(numAI.getPreferredSize());

    contentPane.add(numAI);
    chooseDifficulty = new ButtonGroup();
    JRadioButton easy = new JRadioButton("Easy");
    JRadioButton intermediate = new JRadioButton("Intermediate");
    JRadioButton hard = new JRadioButton("Hard");
    easy.setActionCommand("EASY");
    intermediate.setActionCommand("INTERMEDIATE");
    hard.setActionCommand("HARD");
    chooseDifficulty.add(easy);
    chooseDifficulty.add(intermediate);
    chooseDifficulty.add(hard);
    contentPane.add(easy);
    contentPane.add(intermediate);
    contentPane.add(hard);
    easy.doClick();
    JButton confirm = new JButton("Confirm");
    contentPane.add(confirm);
    confirm.addActionListener(this);

    this.setVisible(true);
  }
 public void hideTime() {
   mMaxXTLabel.setEnabled(false);
   mMinXTLabel.setEnabled(false);
   mMaxXLabel.setEnabled(true);
   mMinXLabel.setEnabled(true);
   mIncLabel.setEnabled(true);
   xMin.setEnabled(true);
   xMax.setEnabled(true);
   xInc.setEnabled(true);
   mStartSpinner.setEnabled(false);
   mEndSpinner.setEnabled(false);
   xTics.setEnabled(true);
   mPlotXGrid.setEnabled(true);
   mXIncLabel.setEnabled(true);
 }
 @Override
 public boolean isModified() {
   VcsContentAnnotationSettings settings = VcsContentAnnotationSettings.getInstance(myProject);
   if (myHighlightRecentlyChanged.isSelected() != settings.isShow()) return true;
   if (!Comparing.equal(myHighlightInterval.getValue(), settings.getLimitDays())) return true;
   return false;
 }
 @Override
 void doPropertyChange(PropertyChangeEvent evt) {
   super.doPropertyChange(evt);
   if (checkIsFieldChange(Field.SEMESTER, evt)) {
     spinnerSemester.setValue(kurseSemesterwahlModel.getSemester());
   }
 }
  /** {@inheritDoc} */
  public void setEnabled(boolean b) {
    if (b != isEnabled()) {
      super.setEnabled(b);

      if ((selectedComponents & DISPLAY_DATE) > 0) {
        yearDecrButton.setEnabled(b);
        monthDecrButton.setEnabled(b);
        monthYearLabel.setEnabled(b);
        monthIncrButton.setEnabled(b);
        yearIncrButton.setEnabled(b);

        for (int day = 0; day < 7; day++) {
          dayOfWeekLabels[day].setEnabled(b);
        }

        for (int row = 0; row < 6; row++) {
          for (int day = 0; day < 7; day++) {
            if (dayButtons[row][day].getText().length() > 0) {
              dayButtons[row][day].setEnabled(b);
            }
          }
        }
      }

      if ((selectedComponents & DISPLAY_TIME) > 0) {
        spinner.setEnabled(b);
      }
    }
  }
 public void saveDisplayObjectType() {
   DOTPoint newDOTPoint =
       (DOTPoint) _dotDefinitionDialogFrame.getScratchDisplayObjectType().getCopy(null);
   final String name = _dotDefinitionDialogFrame.getNameText();
   if ((name == null) || (name.length() == 0)) {
     JOptionPane.showMessageDialog(
         new JFrame(), "Bitte geben Sie einen Namen an!", "Fehler", JOptionPane.ERROR_MESSAGE);
     return;
   }
   if (!_dotDefinitionDialogFrame.isReviseOnly()) {
     if (_dotDefinitionDialogFrame.getDotManager().containsDisplayObjectType(name)) {
       JOptionPane.showMessageDialog(
           new JFrame(),
           "Ein Darstellungstyp mit diesem Namen existiert bereits!",
           "Fehler",
           JOptionPane.ERROR_MESSAGE);
       return;
     }
   }
   newDOTPoint.setName(name);
   newDOTPoint.setInfo(_dotDefinitionDialogFrame.getInfoText());
   final Object value = _translationFactorSpinner.getValue();
   if (value instanceof Number) {
     final Number number = (Number) value;
     newDOTPoint.setTranslationFactor(number.doubleValue());
   }
   newDOTPoint.setJoinByLine(_joinByLineCheckBox.isSelected());
   _dotDefinitionDialogFrame.getDotManager().saveDisplayObjectType(newDOTPoint);
   _dotDefinitionDialogFrame.setDisplayObjectType(newDOTPoint, true);
 }
Example #23
0
  private void resetSettings() {
    downloadDirectoryTextField.setText(Groovesquid.getConfig().getDownloadDirectory());
    maxParallelDownloadsSpinner.setValue(Groovesquid.getConfig().getMaxParallelDownloads());
    fileNameSchemeTextField.setText(Groovesquid.getConfig().getFileNameScheme());

    String[] downloadCompleteActions = Config.DownloadComplete.names();
    DefaultComboBoxModel downloadCompleteComboBoxModel = new DefaultComboBoxModel();
    downloadCompletedComboBox.setModel(downloadCompleteComboBoxModel);
    for (String downloadCompleteAction : downloadCompleteActions) {
      downloadCompleteComboBoxModel.addElement(I18n.getLocaleString(downloadCompleteAction));
    }
    downloadCompletedComboBox.setSelectedIndex(Groovesquid.getConfig().getDownloadComplete());

    String[] startTabs = Config.StartTab.names();
    DefaultComboBoxModel startTabComboBoxModel = new DefaultComboBoxModel();
    startTabComboBox.setModel(startTabComboBoxModel);
    for (String startTab : startTabs) {
      startTabComboBoxModel.addElement(I18n.getLocaleString(startTab));
    }
    startTabComboBox.setSelectedIndex(Groovesquid.getConfig().getStartTab());

    String[] fileExistsActions = Config.FileExists.names();
    DefaultComboBoxModel fileExistsComboBoxModel = new DefaultComboBoxModel();
    fileExistsComboBox.setModel(fileExistsComboBoxModel);
    for (String fileExistsAction : fileExistsActions) {
      fileExistsComboBoxModel.addElement(I18n.getLocaleString(fileExistsAction));
    }
    fileExistsComboBox.setSelectedIndex(Groovesquid.getConfig().getFileExists());

    if (Groovesquid.getConfig().getProxyHost() != null
        && Groovesquid.getConfig().getProxyPort() != null) {
      proxyHostTextField.setText(Groovesquid.getConfig().getProxyHost());
      proxyPortTextField.setText(Groovesquid.getConfig().getProxyPort().toString());
    }
  }
    protected JPanel createForm() {
      JPanel panel = new JPanel();
      panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
      // Time
      JPanel pT = new JPanel(new FlowLayout());
      pT.setBorder(BorderFactory.createTitledBorder("Start Time"));
      hh = new JSpinner(new SpinnerNumberModel(Util.getHours(myrow.getTime()), 0, 99, 1));
      hh.setEditor(new JSpinner.NumberEditor(hh, "00"));
      pT.add(hh);
      pT.add(new JLabel("h "));
      mm = new JSpinner(new SpinnerNumberModel(Util.getMinutes(myrow.getTime()), 0, 59, 1));
      mm.setEditor(new JSpinner.NumberEditor(mm, "00"));
      pT.add(mm);
      pT.add(new JLabel("m "));
      ss = new JSpinner(new SpinnerNumberModel(Util.getSeconds(myrow.getTime()), 0, 59, 1));
      ss.setEditor(new JSpinner.NumberEditor(ss, "00"));
      pT.add(ss);
      pT.add(new JLabel("s"));
      panel.add(pT);
      // Green
      JPanel pG = new JPanel(new BorderLayout());
      pG.setBorder(BorderFactory.createTitledBorder("Green (sec.)"));
      green = new JSpinner(new SpinnerNumberModel(myrow.getGreen() * conversion, 0.0, 99999.99, 1));
      green.setEditor(new JSpinner.NumberEditor(green, "####0.##"));
      pG.add(green);
      panel.add(pG);
      // Red
      JPanel pR = new JPanel(new BorderLayout());
      pR.setBorder(BorderFactory.createTitledBorder("Red (sec.)"));
      red = new JSpinner(new SpinnerNumberModel(myrow.getRed() * conversion, 0.0, 99999.99, 1));
      red.setEditor(new JSpinner.NumberEditor(red, "####0.##"));
      pR.add(red);
      panel.add(pR);

      JPanel bp = new JPanel(new FlowLayout());
      JButton bOK = new JButton("    OK    ");
      bOK.setActionCommand(cmdOK);
      bOK.addActionListener(new ButtonEventsListener());
      JButton bCancel = new JButton("Cancel");
      bCancel.setActionCommand(cmdCancel);
      bCancel.addActionListener(new ButtonEventsListener());
      bp.add(bOK);
      bp.add(bCancel);
      panel.add(bp);
      return panel;
    }
  public void setXRangeToTime() {
    showTime();
    // set the x axis from the time range of the data
    GeoDate minDate = mFileViewer.getMinDate();
    GeoDate maxDate = mFileViewer.getMaxDate();

    xTics.setValue(new Integer(xTicsVal));
  }
Example #26
0
  @Override
  public void actionPerformed(ActionEvent e) {
    parent.newGame(
        (int) numAI.getValue(),
        AIPlayer.Difficulty.valueOf(chooseDifficulty.getSelection().getActionCommand()));

    this.dispose();
  }
Example #27
0
 /** Reaction to value changes in the form. */
 public void stateChanged(ChangeEvent e) {
   String nm = ((JComponent) e.getSource()).getName();
   double x;
   if (nm.equals(nmSpinMaxFlow)) {
     x = (Double) spinMaxFlow.getValue();
     mf = x;
   }
   if (nm.equals(nmSpinCapDrop)) {
     x = (Double) spinCapDrop.getValue();
     drp = x;
   }
   if (nm.equals(nmSpinCritDen)) {
     x = (Double) spinCritDen.getValue();
     if (x <= jd) cd = x;
   }
   if (nm.equals(nmSpinJamDen)) {
     x = (Double) spinJamDen.getValue();
     if (x >= cd) jd = x;
   }
   if (nm.equals(nmSpinVff)) {
     x = (Double) spinVff.getValue();
     if (x > 0.0) cd = mf / x;
     double xx = (Double) spinWc.getValue();
     if (xx > 0.0) jd = cd + (mf / xx);
   }
   if (nm.equals(nmSpinWc)) {
     x = (Double) spinWc.getValue();
     if (x > 0.0) jd = cd + (mf / x);
   }
   updateSpinners();
   updateFDSeries();
   return;
 }
Example #28
0
 private static int getSpinnerBaseline(JSpinner spinner, int height) {
   JComponent editor = spinner.getEditor();
   if (editor instanceof JSpinner.DefaultEditor) {
     JSpinner.DefaultEditor defaultEditor = (JSpinner.DefaultEditor) editor;
     JTextField tf = defaultEditor.getTextField();
     Insets spinnerInsets = spinner.getInsets();
     Insets editorInsets = defaultEditor.getInsets();
     int offset = spinnerInsets.top + editorInsets.top;
     height -= (offset + spinnerInsets.bottom + editorInsets.bottom);
     if (height <= 0) {
       return -1;
     }
     return offset + getSingleLineTextBaseline(tf, height);
   }
   Insets insets = spinner.getInsets();
   FontMetrics fm = spinner.getFontMetrics(spinner.getFont());
   return insets.top + fm.getAscent();
 }
  private void makeGridOverlay(int centerX, int centerY) {
    IJ.setTool(Toolbar.SPARE2);
    Overlay overlay = vad_.getImagePlus().getOverlay();
    if (overlay == null || overlay.size() == 0) {
      overlay = new Overlay();
    } else {
      overlay.clear();
    }

    int gridWidth = (Integer) gridXSpinner_.getValue();
    int gridHeight = (Integer) gridYSpinner_.getValue();
    int roiWidth = gridWidth * tileWidth_;
    int roiHeight = gridHeight * tileHeight_;

    Roi rectangle = new Roi(centerX - roiWidth / 2, centerY - roiHeight / 2, roiWidth, roiHeight);
    rectangle.setStrokeWidth(20f);
    overlay.add(rectangle);
    vad_.getImagePlus().setOverlay(overlay);
  }
 private void setValue(final JComponent component) {
   final String primitiveFormName = _primitiveForm.getName();
   if (_dotDefinitionDialogFrame.isPropertyStatic(primitiveFormName, _property)) {
     Object object =
         _dotDefinitionDialogFrame.getValueOfStaticProperty(primitiveFormName, _property);
     if (component instanceof JComboBox) {
       final String currentValue;
       if (object instanceof Color) {
         currentValue = ColorManager.getInstance().getColorName((Color) object);
       } else if (object instanceof Integer) {
         Integer i = (Integer) object;
         if (i.equals(Font.PLAIN)) {
           currentValue = STANDARD_FONT;
         } else if (i.equals(Font.BOLD)) {
           currentValue = BOLD_FONT;
         } else if (i.equals(Font.ITALIC)) {
           currentValue = ITALIC_FONT;
         } else {
           currentValue = "Unbekannter Font";
         }
       } else {
         currentValue = (String) object;
       }
       JComboBox comboBox = (JComboBox) component;
       comboBox.setSelectedItem(currentValue);
     } else if (component instanceof JSpinner) {
       JSpinner spinner = (JSpinner) component;
       if (object instanceof Integer) {
         spinner.setValue((Integer) object);
       } else {
         spinner.setValue((Double) object);
       }
     }
   } else {
     if (component instanceof JComboBox) {
       JComboBox comboBox = (JComboBox) component;
       comboBox.setSelectedItem(DOTPoint.getDefaultValue(_property));
     } else if (component instanceof JSpinner) {
       JSpinner spinner = (JSpinner) component;
       spinner.setValue(DOTPoint.getDefaultValue(_property));
     }
   }
 }