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();
 }
Exemplo n.º 2
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());
    }
  }
 @Override
 public void reset() {
   VcsContentAnnotationSettings settings = VcsContentAnnotationSettings.getInstance(myProject);
   myHighlightRecentlyChanged.setSelected(settings.isShow());
   myHighlightInterval.setValue(settings.getLimitDays());
   myHighlightInterval.setEnabled(myHighlightRecentlyChanged.isSelected());
 }
 @Override
 void doPropertyChange(PropertyChangeEvent evt) {
   super.doPropertyChange(evt);
   if (checkIsFieldChange(Field.SEMESTER, evt)) {
     spinnerSemester.setValue(kurseSemesterwahlModel.getSemester());
   }
 }
Exemplo n.º 5
0
  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));
  }
 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));
     }
   }
 }
Exemplo n.º 7
0
 void Load(SpritesNPCManager mgr, int NPCIndex) {
   SpriteNPC t = mgr.mapNPCs.get(NPCIndex);
   txtSpriteSet.setValue(t.bSpriteSet & 0xFF);
   txtBehavior1.setText(Byte.toString(t.bBehavior1));
   txtBehavior2.setText(Byte.toString(t.bBehavior2));
   chkIsTrainer.setSelected(t.bIsTrainer == 1);
   txtTrainerLOS.setText(Byte.toString(t.bTrainerLOS));
   txtScript.setText(String.format("%X", ((int) t.pScript)));
   txtiFlag.setText(BitConverter.toHexString(t.iFlag));
 }
 public void setType(String type) {
   if ("Control Change".equals(type)) {
     channel.setEnabled(true);
     cc.setEnabled(true);
     min.setEnabled(true);
     max.setEnabled(true);
     min.setValue(0);
     max.setValue(127);
     modeList.setEnabled(false);
   } else if ("NRPN".equals(type)) {
     channel.setEnabled(true);
     cc.setEnabled(true);
     min.setEnabled(true);
     max.setEnabled(true);
     min.setValue(0);
     max.setValue(127);
     modeList.setEnabled(false);
   } else if ("Pitch Bend".equals(type)) {
     channel.setEnabled(true);
     cc.setEnabled(false);
     min.setEnabled(true);
     max.setEnabled(true);
     min.setValue(-8192);
     max.setValue(8191);
     modeList.setEnabled(false);
   } else if ("Basenote".equals(type)) {
     channel.setEnabled(false);
     cc.setEnabled(false);
     min.setEnabled(true);
     max.setEnabled(true);
     min.setValue(0);
     max.setValue(127);
     modeList.setEnabled(false);
   } else if ("Scale".equals(type)) {
     channel.setEnabled(false);
     cc.setEnabled(false);
     min.setEnabled(false);
     max.setEnabled(false);
     modeList.setEnabled(false);
   } else if ("Mode Change".equals(type)) {
     channel.setEnabled(false);
     cc.setEnabled(false);
     min.setEnabled(false);
     max.setEnabled(false);
     modeList.setEnabled(true);
   } else if ("Unassigned".equals(type)) {
     channel.setEnabled(false);
     cc.setEnabled(false);
     min.setEnabled(false);
     max.setEnabled(false);
     modeList.setEnabled(false);
   }
 }
  /** {@collect.stats} Sets the values of the controls to reflect the color */
  private void setColor(Color newColor) {
    int red = newColor.getRed();
    int blue = newColor.getBlue();
    int green = newColor.getGreen();

    if (redSlider.getValue() != red) {
      redSlider.setValue(red);
    }
    if (greenSlider.getValue() != green) {
      greenSlider.setValue(green);
    }
    if (blueSlider.getValue() != blue) {
      blueSlider.setValue(blue);
    }

    if (((Integer) redField.getValue()).intValue() != red) redField.setValue(new Integer(red));
    if (((Integer) greenField.getValue()).intValue() != green)
      greenField.setValue(new Integer(green));
    if (((Integer) blueField.getValue()).intValue() != blue) blueField.setValue(new Integer(blue));
  }
Exemplo n.º 10
0
  public void setPreferencesProxyDTO(PreferencesProxyDTO preferencesProxyDTO) {
    switch (preferencesProxyDTO.getProxySettingType()) {
      case 0:
        noProxyRadioButton.setSelected(true);
        break;
      case 1:
        systemProxyRadioButton.setSelected(true);
        break;
      case 2:
        manualProxyRadioButton.setSelected(true);
    }

    if (preferencesProxyDTO.isUseProxyNotSocks()) useProxyRadioButton.setSelected(true);
    else useSocksRadioButton.setSelected(true);

    // for http
    httpProxyAddressTextField.setText(preferencesProxyDTO.getHttpProxyAddress());
    httpProxyPortSpinner.setValue(preferencesProxyDTO.getHttpProxyPort());
    httpProxyUserNameTextField.setText(preferencesProxyDTO.getHttpProxyUserName());
    httpProxyPasswordField.setText(preferencesProxyDTO.getHttpProxyPassword());

    // for https
    httpsProxyAddressTextField.setText(preferencesProxyDTO.getHttpsProxyAddress());
    httpsProxyPortSpinner.setValue(preferencesProxyDTO.getHttpsProxyPort());
    httpsProxyUserNameTextField.setText(preferencesProxyDTO.getHttpsProxyUserName());
    httpsProxyPasswordField.setText(preferencesProxyDTO.getHttpsProxyPassword());

    // for ftp
    ftpProxyAddressTextField.setText(preferencesProxyDTO.getFtpProxyAddress());
    ftpProxyPortSpinner.setValue(preferencesProxyDTO.getFtpProxyPort());
    ftpProxyUserNameTextField.setText(preferencesProxyDTO.getFtpProxyUserName());
    ftpProxyPasswordField.setText(preferencesProxyDTO.getFtpProxyPassword());

    // for ftp
    socksProxyAddressTextField.setText(preferencesProxyDTO.getSocksProxyAddress());
    socksProxyPortSpinner.setValue(preferencesProxyDTO.getSocksProxyPort());
    socksProxyUserNameTextField.setText(preferencesProxyDTO.getSocksProxyUserName());
    socksProxyPasswordField.setText(preferencesProxyDTO.getSocksProxyPassword());

    this.preferencesProxyDTO = preferencesProxyDTO;
  }
Exemplo n.º 11
0
  public void setAdvancedValues() {
    // get pretty ranges for the current parameters
    // get the range for the station value
    double min = 10000;
    double max = 0;
    for (int fc = 0; fc < mFileViewer.mNumOpenFiles; fc++) {
      OpenDataFile of = (OpenDataFile) mFileViewer.mOpenFiles.elementAt(fc);

      for (int sec = 0; sec < of.mNumSections; sec++) {
        Section sech = (Section) of.mSections.elementAt(sec);

        if (sech.mNumCasts == 0) {
          continue;
        }

        for (int stc = 0; stc < sech.mStations.size(); stc++) {
          Station sh = (Station) sech.mStations.elementAt(stc);
          if (!sh.mUseStn) {
            continue;
          }

          // get the station value
          double y = sh.getStnValue(mSelYParam);
          if (y == JOAConstants.MISSINGVALUE || y >= JOAConstants.EPICMISSINGVALUE) {
            continue;
          } else {
            min = y < min ? y : min;
            max = y > max ? y : max;
          }
        }
      }
    }

    Triplet newRange = JOAFormulas.GetPrettyRange(min, max);
    double yMinv = newRange.getVal1();
    double yMaxv = newRange.getVal2();
    double yIncv = newRange.getVal3();
    yMin.setText(JOAFormulas.formatDouble(String.valueOf(yMinv), 3, false));
    yMax.setText(JOAFormulas.formatDouble(String.valueOf(yMaxv), 3, false));
    yInc.setText(JOAFormulas.formatDouble(String.valueOf(yIncv), 3, false));
    yTics.setValue(new Integer(yTicsVal));
    if (b1.isSelected()) {
      mOffset = JOAConstants.PROFSEQUENCE;
      setXRangeToSequence();
    } else if (b2.isSelected()) {
      mOffset = JOAConstants.PROFDISTANCE;
      setXRangeToDistance();
    } else if (b3.isSelected()) {
      mOffset = JOAConstants.PROFTIME;
      setXRangeToTime();
    }
  }
 /**
  * Sets the values of the configuration dialog to the ones specified by the given
  * WebCrawling-instance.
  *
  * @param wcCfg the WebCrawling-instance containing the values for the dialog
  */
 public void setConfig(WebCrawlingConfig wcCfg) {
   if (wcCfg != null) {
     tfSearchEngineURL.setText(wcCfg.getSearchEngineURL());
     sliderNumberOfRetries.setValue(wcCfg.getNumberOfRetries());
     sliderIntervalBetweenRetries.setValue(wcCfg.getIntervalBetweenRetries());
     tfAdditionalKeywords.setText(wcCfg.getAdditionalKeywords());
     rbAfterSearchString.setSelected(wcCfg.getAdditionalKeywordsAfterSearchString());
     rbBeforeSearchString.setSelected(!wcCfg.getAdditionalKeywordsAfterSearchString());
     jsNumberOfPages.setValue(new Integer(wcCfg.getNumberOfRequestedPages()));
     tfPathStoreRetrievedPages.setText(wcCfg.getPathStoreRetrievedPages());
     tfPathExternalCrawler.setText(wcCfg.getPathExternalCrawler());
     cbStoreURLList.setSelected(wcCfg.isStoreURLList());
   }
 }
Exemplo n.º 13
0
 public void setXRangeToSequence() {
   hideTime();
   // set the x axis from the total mercator distance
   double tempXMin = 0;
   double tempXMax = mFileViewer.mTotalStations;
   Triplet newRange = JOAFormulas.GetPrettyRange(tempXMin, tempXMax);
   double xMinv = newRange.getVal1();
   double xMaxv = newRange.getVal2();
   double xIncv = newRange.getVal3();
   xMin.setText(String.valueOf((int) xMinv));
   xMax.setText(String.valueOf((int) xMaxv));
   xInc.setText(String.valueOf((int) xIncv));
   xTics.setValue(new Integer(xTicsVal));
 }
Exemplo n.º 14
0
 public void setXRangeToDistance() {
   hideTime();
   // set the x axis from the total mercator distance
   double tempXMin = 0;
   double tempXMax = mFileViewer.mTotMercDist * 1.852;
   Triplet newRange = JOAFormulas.GetPrettyRange(tempXMin, tempXMax);
   double xMinv = newRange.getVal1();
   double xMaxv = newRange.getVal2();
   double xIncv = newRange.getVal3();
   xMin.setText(JOAFormulas.formatDouble(String.valueOf(xMinv), 3, false));
   xMax.setText(JOAFormulas.formatDouble(String.valueOf(xMaxv), 3, false));
   xInc.setText(JOAFormulas.formatDouble(String.valueOf(xIncv), 3, false));
   xTics.setValue(new Integer(xTicsVal));
 }
Exemplo n.º 15
0
  @Override
  public void setAIChoices(String[] value) {

    java.util.List<String> choiceList = new ArrayList<String>();
    for (String v : value) {
      choiceList.add(v);
    }

    aiModel.setList(choiceList);

    if (value.length > 0) {
      aiChoices.setValue(value[0]);
    }
  }
Exemplo n.º 16
0
 /** Updates spinner values. */
 private void updateSpinners() {
   spinMaxFlow.setValue((Double) mf);
   spinCapDrop.setValue((Double) drp);
   spinCritDen.setValue((Double) cd);
   spinJamDen.setValue((Double) jd);
   spinVff.setValue((Double) (mf / cd));
   spinWc.setValue((Double) (mf / (jd - cd)));
   return;
 }
  public void reset() {
    myEnableCompileServer.setSelected(mySettings.COMPILE_SERVER_ENABLED);
    myCompilationServerPort.setText(mySettings.COMPILE_SERVER_PORT);

    Sdk sdk =
        mySettings.COMPILE_SERVER_SDK == null
            ? null
            : ProjectJdkTable.getInstance().findJdk(mySettings.COMPILE_SERVER_SDK);
    myCompilationServerSdk.setSelectedJdk(sdk);

    myCompilationServerMaximumHeapSize.setText(mySettings.COMPILE_SERVER_MAXIMUM_HEAP_SIZE);
    myCompilationServerJvmParameters.setText(mySettings.COMPILE_SERVER_JVM_PARAMETERS);
    showTypeInfoOnCheckBox.setSelected(mySettings.SHOW_TYPE_TOOLTIP_ON_MOUSE_HOVER);
    delaySpinner.setValue(mySettings.SHOW_TYPE_TOOLTIP_DELAY);
  }
  public JPanel getAdditionalCharacteristicsPanel(final DisplayObjectType displayObjectType) {
    JLabel translationFactorLabel = new JLabel("Verschiebungsfaktor: ");
    SpinnerModel spinnerModel = new SpinnerNumberModel(100, 0, 5000, 1);
    _translationFactorSpinner.setModel(spinnerModel);
    _translationFactorSpinner.setMaximumSize(new Dimension(60, 30));
    _translationFactorSpinner.setEnabled(_dotDefinitionDialogFrame.isEditable());
    JPanel translationPanel = new JPanel();
    translationPanel.setLayout(new BoxLayout(translationPanel, BoxLayout.X_AXIS));
    translationPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 10));
    translationPanel.add(translationFactorLabel);
    translationPanel.add(_translationFactorSpinner);

    JLabel joinByLineLabel = new JLabel("Verbindungslinie: ");
    _joinByLineCheckBox.setSelected(false);
    _joinByLineCheckBox.setEnabled(_dotDefinitionDialogFrame.isEditable());
    JPanel joinByLinePanel = new JPanel();
    joinByLinePanel.setLayout(new BoxLayout(joinByLinePanel, BoxLayout.X_AXIS));
    joinByLinePanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    joinByLinePanel.add(joinByLineLabel);
    joinByLinePanel.add(_joinByLineCheckBox);

    JPanel invisiblePanel = new JPanel();
    invisiblePanel.add(new JTextField());
    invisiblePanel.setVisible(false);

    JPanel thePanel = new JPanel();
    thePanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
    thePanel.setLayout(new SpringLayout());
    thePanel.add(translationPanel);
    thePanel.add(joinByLinePanel);
    thePanel.add(invisiblePanel);
    SpringUtilities.makeCompactGrid(thePanel, 3, 5, 5);

    if (displayObjectType != null) {
      DOTPoint dotPoint = (DOTPoint) displayObjectType;
      _translationFactorSpinner.setValue(dotPoint.getTranslationFactor());
      _joinByLineCheckBox.setSelected(dotPoint.isJoinByLine());
    }
    addChangeListeners(); // Erst jetzt, denn sonst werden die Setzungen von
                          // _translationFactorSpinner und _joinByLineCheckBox schon verarbeitet!

    return thePanel;
  }
Exemplo n.º 19
0
  /** Update date spinner to synchronize with the other spinners */
  private void updateDate() {
    // Get current month and year in int
    int month = ((SpinnerListModel) jspMonth.getModel()).getList().indexOf(jspMonth.getValue());
    int year = ((Integer) spinnerYear.getValue()).intValue();

    // Set a new maximum number of days for the new month and year
    SpinnerNumberModel numberModel = (SpinnerNumberModel) jspDay.getModel();
    numberModel.setMaximum(new Integer(maxDaysInMonth(year, month)));

    // Set a new current day if it exceeds the maximum
    if (((Integer) (numberModel.getValue())).intValue() > maxDaysInMonth(year, month))
      numberModel.setValue(new Integer(maxDaysInMonth(year, month)));

    // Get the current day
    int day = ((Integer) jspDay.getValue()).intValue();

    // Set a new date in the date spinner
    jspDate.setValue(new GregorianCalendar(year, month, day).getTime());
  }
  public ScalaApplicationSettingsForm(ScalaApplicationSettings settings) {
    mySettings = settings;

    myEnableCompileServer.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            updateCompilationServerSettingsPanel();
          }
        });

    initCompilerTypeCmb();
    initCompileOrderCmb();

    ProjectSdksModel model = new ProjectSdksModel();
    model.reset(null);

    myCompilationServerSdk = new JdkComboBox(model);
    myCompilationServerSdk.insertItemAt(new JdkComboBox.NoneJdkComboBoxItem(), 0);

    mySdkPanel.add(myCompilationServerSdk, BorderLayout.CENTER);
    mySdkPanel.setSize(mySdkPanel.getPreferredSize());

    myNote.setForeground(JBColor.GRAY);

    delaySpinner.setEnabled(showTypeInfoOnCheckBox.isSelected());
    showTypeInfoOnCheckBox.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            delaySpinner.setEnabled(showTypeInfoOnCheckBox.isSelected());
          }
        });
    delaySpinner.setValue(mySettings.SHOW_TYPE_TOOLTIP_DELAY);

    updateCompilationServerSettingsPanel();
  }
Exemplo n.º 21
0
    private JPanel makeInteriorAttributesPanel() {
      JPanel outerPanel = new JPanel(new BorderLayout(6, 6));
      outerPanel.setBorder(this.createTitleBorder("Surface Attributes"));

      GridLayout nameLayout = new GridLayout(0, 1, 6, 6);
      JPanel namePanel = new JPanel(nameLayout);

      GridLayout valueLayout = new GridLayout(0, 1, 6, 6);
      JPanel valuePanel = new JPanel(valueLayout);

      namePanel.add(new JLabel("Style"));
      final JComboBox cb1 = new JComboBox(new String[] {"None", "Solid"});
      cb1.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              currentInteriorStyle = (String) cb1.getSelectedItem();
              update();
            }
          });
      cb1.setSelectedItem("Solid");
      valuePanel.add(cb1);

      namePanel.add(new JLabel("Opacity"));
      JSpinner sp = new JSpinner(new SpinnerNumberModel(this.currentBorderOpacity, 0, 10, 1));
      sp.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent changeEvent) {
              currentInteriorOpacity = (Integer) ((JSpinner) changeEvent.getSource()).getValue();
              update();
            }
          });
      valuePanel.add(sp);

      namePanel.add(new JLabel("Color"));
      final JComboBox cb2 = new JComboBox(new String[] {"Red", "Green", "Blue", "Yellow"});
      cb2.setSelectedItem(currentInteriorColor);
      cb2.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              currentInteriorColor =
                  (String) ((JComboBox) actionEvent.getSource()).getSelectedItem();
              update();
            }
          });
      valuePanel.add(cb2);

      namePanel.add(new JLabel("Border"));
      final JComboBox cb5 = new JComboBox(new String[] {"None", "Solid"});
      cb5.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              currentBorderStyle = (String) cb5.getSelectedItem();
              update();
            }
          });
      cb5.setSelectedItem("Solid");
      valuePanel.add(cb5);

      namePanel.add(new JLabel("Border Width"));
      sp = new JSpinner(new SpinnerNumberModel(this.currentBorderWidth, 1d, 10d, 1d));
      sp.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent changeEvent) {
              currentBorderWidth = (Double) ((JSpinner) changeEvent.getSource()).getValue();
              update();
            }
          });
      sp.setValue(currentBorderWidth);
      valuePanel.add(sp);

      namePanel.add(new JLabel("Border Color"));
      JComboBox cb4 = new JComboBox(new String[] {"Red", "Green", "Blue", "Yellow"});
      cb4.setSelectedItem(currentBorderColor);
      cb4.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              currentBorderColor = (String) ((JComboBox) actionEvent.getSource()).getSelectedItem();
              update();
            }
          });
      valuePanel.add(cb4);

      namePanel.add(new JLabel("Border Opacity"));
      sp = new JSpinner(new SpinnerNumberModel(this.currentBorderOpacity, 0, 10, 1));
      sp.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent changeEvent) {
              currentBorderOpacity = (Integer) ((JSpinner) changeEvent.getSource()).getValue();
              update();
            }
          });
      valuePanel.add(sp);

      outerPanel.add(namePanel, BorderLayout.WEST);
      outerPanel.add(valuePanel, BorderLayout.CENTER);

      return outerPanel;
    }
Exemplo n.º 22
0
  static String[] input(int d, int m, int y) { // input frame for schedule
    String[] out = new String[4]; // appointment info storage

    final String[] doctors = {"Dr. Whitehead", "Dr. Namie", "Dr. Liddell"};

    final JFrame input = new JFrame("Make Appointment");
    Container pane1;
    JPanel pan = new JPanel(null);
    JLabel doctor = new JLabel("Choose your Doctor:");
    JLabel da = new JLabel("Date:");
    /*JLabel day=new JLabel(Integer.toString(d));
    JLabel mo=new JLabel("Month:");
    JLabel month=new JLabel(Integer.toString(m));
    JLabel ye=new JLabel("Year:");
    JLabel year=new JLabel(Integer.toString(y));*/
    JLabel time = new JLabel("Appointment Time:");
    JButton submit = new JButton("Submit");
    docName = new JComboBox(doctors);

    JSpinner timeSpinner = new JSpinner(new SpinnerDateModel());
    JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(timeSpinner, "hh:mm a");
    timeSpinner.setEditor(timeEditor);
    timeSpinner.setValue(new Date());

    JSpinner dateSpinner = new JSpinner(new SpinnerDateModel());
    JSpinner.DateEditor dateEditor = new JSpinner.DateEditor(dateSpinner, "MMM/dd/yyyy");
    dateSpinner.setEditor(dateEditor);
    dateSpinner.setValue(new Date());

    input.setSize(330, 375); // Set size to 400x400 pixels
    pane1 = input.getContentPane();
    pane1.setLayout(null); // Apply null layout
    pan.setLayout(new GridLayout(4, 2, 20, 50));
    pane1.setSize((int) (input.getHeight() / 2), (int) (input.getWidth() / 2));
    pane1.setLocation(
        input.getHeight() - ((int) (input.getHeight() / 2)),
        input.getWidth() - ((int) (input.getWidth() / 2))); // trying to center failed
    input.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // Close when X is clicked
    pane1.add(pan);
    // pan.add(ye);
    // pan.add(year);
    pan.add(da);
    pan.add(dateSpinner);
    pan.add(time);
    pan.add(timeSpinner);
    pan.add(doctor);
    pan.add(docName);
    pan.add(submit);

    submit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            fmain.setVisible(true);
            input.setVisible(false);
          }
        });

    pan.setBounds(0, 0, 320, 335);
    input.setResizable(false);
    input.setVisible(true);
    return out;
  }
Exemplo n.º 23
0
    private JPanel makePathAttributesPanel() {
      JPanel outerPanel = new JPanel(new BorderLayout(6, 6));
      outerPanel.setBorder(this.createTitleBorder("Path Attributes"));

      GridLayout nameLayout = new GridLayout(0, 1, 6, 6);
      JPanel namePanel = new JPanel(nameLayout);

      GridLayout valueLayout = new GridLayout(0, 1, 6, 6);
      JPanel valuePanel = new JPanel(valueLayout);

      namePanel.add(new JLabel("Follow Terrain"));
      JCheckBox ckb = new JCheckBox();
      ckb.setSelected(currentFollowTerrain);
      ckb.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              currentFollowTerrain = ((JCheckBox) actionEvent.getSource()).isSelected();
              update();
            }
          });
      valuePanel.add(ckb);

      JLabel label;

      namePanel.add(label = new JLabel("Conformance"));
      int[] values = new int[] {1, 2, 4, 8, 10, 15, 20, 30, 40, 50};
      String[] strings = new String[values.length];
      for (int i = 0; i < values.length; i++) {
        strings[i] = Integer.toString(values[i]) + " pixels";
      }
      JSpinner sp = new JSpinner(new SpinnerListModel(strings));
      onTerrainOnlyItems.add(label);
      onTerrainOnlyItems.add(sp);
      sp.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent changeEvent) {
              String v = (String) ((JSpinner) changeEvent.getSource()).getValue();
              currentTerrainConformance = Integer.parseInt(v.substring(0, v.indexOf(" ")));
              update();
            }
          });
      sp.setValue(Integer.toString(currentTerrainConformance) + " pixels");
      valuePanel.add(sp);

      namePanel.add(label = new JLabel("Subsegments"));
      sp = new JSpinner(new SpinnerListModel(new String[] {"1", "2", "5", "10", "20", "40", "50"}));
      offTerrainOnlyItems.add(label);
      offTerrainOnlyItems.add(sp);
      sp.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent changeEvent) {
              String v = (String) ((JSpinner) changeEvent.getSource()).getValue();
              currentNumSubsegments = Integer.parseInt(v);
              update();
            }
          });
      sp.setValue(Integer.toString(currentNumSubsegments));
      valuePanel.add(sp);

      namePanel.add(new JLabel("Type"));
      final JComboBox cb = new JComboBox(new String[] {"Great Circle", "Linear", "Rhumb Line"});
      cb.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              currentPathType = (String) cb.getSelectedItem();
              update();
            }
          });
      cb.setSelectedItem("Great Circle");
      valuePanel.add(cb);

      namePanel.add(new JLabel("Style"));
      final JComboBox cb1 = new JComboBox(new String[] {"None", "Solid", "Dash"});
      cb1.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              currentPathStyle = (String) cb1.getSelectedItem();
              update();
            }
          });
      cb1.setSelectedItem("Solid");
      valuePanel.add(cb1);

      namePanel.add(new JLabel("Width"));
      sp = new JSpinner(new SpinnerNumberModel(this.currentPathWidth, 1d, 10d, 1d));
      sp.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent changeEvent) {
              currentPathWidth = (Double) ((JSpinner) changeEvent.getSource()).getValue();
              update();
            }
          });
      sp.setValue(currentPathWidth);
      valuePanel.add(sp);

      namePanel.add(new JLabel("Color"));
      JComboBox cb2 = new JComboBox(new String[] {"Red", "Green", "Blue", "Yellow"});
      cb2.setSelectedItem(currentPathColor);
      cb2.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              currentPathColor = (String) ((JComboBox) actionEvent.getSource()).getSelectedItem();
              update();
            }
          });
      valuePanel.add(cb2);

      namePanel.add(new JLabel("Opacity"));
      sp = new JSpinner(new SpinnerNumberModel(this.currentPathOpacity, 0, 10, 1));
      sp.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent changeEvent) {
              currentPathOpacity = (Integer) ((JSpinner) changeEvent.getSource()).getValue();
              update();
            }
          });
      valuePanel.add(sp);

      namePanel.add(new JLabel("Offset"));
      sp =
          new JSpinner(
              new SpinnerListModel(
                  new String[] {"0", "10", "100", "1000", "10000", "100000", "1000000"}));
      sp.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent changeEvent) {
              currentOffset =
                  Float.parseFloat((String) ((JSpinner) changeEvent.getSource()).getValue());
              update();
            }
          });
      sp.setValue("0");
      valuePanel.add(sp);

      outerPanel.add(namePanel, BorderLayout.WEST);
      outerPanel.add(valuePanel, BorderLayout.CENTER);

      return outerPanel;
    }
      DOTItemDialog() {
        super();
        _primitiveForm = primitiveForm;
        _property = property;

        _dynamicDefinitionComponent =
            new DynamicDefinitionComponent(_configuration, new DOTPointPlugin());
        final Object propertyValue = initDynamicDefinitionComponent();

        final JPanel panel = new JPanel();
        panel.setLayout(new SpringLayout());

        JLabel aLabel = null;
        if (_property == DOTProperty.DURCHMESSER) {
          aLabel = new JLabel("Durchmesser: ");
          if (propertyValue != null) {
            _diameterSpinner.setValue(propertyValue);
          }
          _component = _diameterSpinner;
        } else if (_property == DOTProperty.FARBE || _property == DOTProperty.FUELLUNG) {
          aLabel = new JLabel("Farbe: ");
          if (propertyValue != null) {
            _colorComboBox.setSelectedItem(propertyValue);
          }
          _component = _colorComboBox;
        } else if (_property == DOTProperty.GROESSE) {
          aLabel = new JLabel("Schriftgröße: ");
          if (propertyValue != null) {
            _textSizeSpinner.setValue(propertyValue);
          }
          _component = _textSizeSpinner;
        } else if (_property == DOTProperty.STRICHBREITE) {
          aLabel = new JLabel("Strichbreite: ");
          if (propertyValue != null) {
            _strokeWidthSpinner.setValue(propertyValue);
          }
          _component = _strokeWidthSpinner;
        } else if (_property == DOTProperty.TEXT) {
          aLabel = new JLabel("Text: ");
          prepareTextComboBox(propertyValue);
          _component = _textComboBox;
        } else if (_property == DOTProperty.TEXTSTIL) {
          aLabel = new JLabel("Textstil: ");
          if (propertyValue != null) {
            _textStyleComboBox.setSelectedItem(propertyValue);
          }
          _component = _textStyleComboBox;
        } else if (_property == DOTProperty.TRANSPARENZ) {
          aLabel = new JLabel("Tranzparenz: ");
          if (propertyValue != null) {
            _transparencySpinner.setValue(propertyValue);
          }
          _component = _transparencySpinner;
        }
        panel.add(aLabel);
        panel.add(_component);

        panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0));
        SpringUtilities.makeCompactGrid(panel, 2, 20, 5);

        final JButton saveButton = new JButton("Speichern");
        saveButton.setEnabled(_dotDefinitionDialogFrame.isEditable());
        final JButton cancelButton = new JButton("Dialog schließen");

        final JPanel buttonsPanel = new JPanel();
        buttonsPanel.setLayout(new SpringLayout());

        buttonsPanel.add(saveButton);
        buttonsPanel.add(cancelButton);

        buttonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
        SpringUtilities.makeCompactGrid(buttonsPanel, 2, 20, 5);
        addButtonListeners(saveButton, cancelButton);

        setTitle("GND: Darstellungsfestlegung für Punkte");
        setLayout(new BorderLayout());
        add(new JScrollPane(panel), BorderLayout.NORTH);
        add(new JScrollPane(_dynamicDefinitionComponent), BorderLayout.CENTER);
        add(buttonsPanel, BorderLayout.SOUTH);
        pack();
        setSize(700, 550);
        final Rectangle bounds = getBounds();
        setLocation(
            new Point((int) (bounds.getHeight() / 1.5 + 300), (int) (bounds.getWidth() / 1.5)));
      }
 // Reset combobox and spinner
 private void courseReset() {
   coursecombobox.setSelectedIndex(0);
   spinner.setValue(0);
 }
 private static void setValue(JSpinner spinner, int value) {
   spinner.setValue(value);
 }
Exemplo n.º 27
0
  private void initComponents() {
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    setTitle(I18n.getLocaleString("SETTINGS"));
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent evt) {
            formWindowClosing(evt);
          }
        });

    maxParallelDownloadsLabel = new JLabel(I18n.getLocaleString("MAX_PARALLEL_DOWNLOADS"));
    maxParallelDownloadsLabel.setFont(
        new Font(maxParallelDownloadsLabel.getFont().getName(), Font.BOLD, 11));

    downloadDirectoryLabel = new JLabel(I18n.getLocaleString("DOWNLOAD_DIRECTORY"));
    downloadDirectoryLabel.setFont(
        new Font(downloadDirectoryLabel.getFont().getName(), Font.BOLD, 11));

    downloadDirectoryTextField = new JTextField();
    downloadDirectoryTextField.setRequestFocusEnabled(false);

    maxParallelDownloadsSpinner = new JSpinner();
    maxParallelDownloadsSpinner.setModel(new SpinnerNumberModel(10, 1, null, 1));
    maxParallelDownloadsSpinner.setValue(10);

    saveSettingsButton = new JButton(I18n.getLocaleString("SAVE_AND_CLOSE"));
    saveSettingsButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            saveSettingsButtonActionPerformed(evt);
          }
        });

    downloadDirectoryButton = new JButton("...");
    downloadDirectoryButton.setFocusable(false);
    downloadDirectoryButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            downloadDirectoryButtonActionPerformed(evt);
          }
        });

    fileNameSchemeTextField = new JTextField();
    fileNameSchemeTextField.setFont(new Font(Font.MONOSPACED, 0, 12));

    filenameSchemeLabel = new JLabel(I18n.getLocaleString("FILENAME_SCHEME"));
    filenameSchemeLabel.setFont(new Font(filenameSchemeLabel.getFont().getName(), Font.BOLD, 11));

    filenameSchemeDescriptionLabel = new JLabel();
    filenameSchemeDescriptionLabel.setFont(
        new Font(filenameSchemeDescriptionLabel.getFont().getName(), Font.PLAIN, 11));
    filenameSchemeDescriptionLabel.setLabelFor(fileNameSchemeTextField);
    String tagStyle = "font-family: Monospaced; font-weight: bold;";
    filenameSchemeDescriptionLabel.setText(
        "<html><body>"
            + I18n.getLocaleString("FILENAME_SCHEME_DESCRIPTION")
                .replace("&lt;", "<span style=\"" + tagStyle + "\">&lt;")
                .replace("&gt;", "&gt;</span>")
                .replaceFirst("/", "<span style=\"" + tagStyle + "\">/</span>")
            + "</body></html>");

    /*searchAutocompleteLabel = new JLabel(I18n.getLocaleString("SEARCH_AUTOCOMPLETE"));
    searchAutocompleteLabel.setFont(new Font(searchAutocompleteLabel.getFont().getName(), Font.BOLD, 11));

    searchAutocompleteCheckBox = new JCheckBox(I18n.getLocaleString("ENABLED"));
    searchAutocompleteCheckBox.setFont(new Font(searchAutocompleteCheckBox.getFont().getName(), Font.BOLD, 11));*/

    startTabLabel = new JLabel(I18n.getLocaleString("START_TAB"));
    startTabLabel.setFont(new Font(startTabLabel.getFont().getName(), Font.BOLD, 11));

    startTabComboBox = new JComboBox();

    downloadCompletedLabel = new JLabel(I18n.getLocaleString("DOWNLOAD_COMPLETED"));
    downloadCompletedLabel.setFont(
        new Font(downloadCompletedLabel.getFont().getName(), Font.BOLD, 11));

    downloadCompletedComboBox = new JComboBox();

    languageLabel = new JLabel(I18n.getLocaleString("LANGUAGE"));
    languageLabel.setFont(new Font(languageLabel.getFont().getName(), Font.BOLD, 11));

    languageComboBox = new JComboBox();
    DefaultComboBoxModel languageComboBoxModel = new DefaultComboBoxModel();
    languageComboBox.setModel(languageComboBoxModel);
    for (Locale locale : I18n.getLocales()) {
      languageComboBoxModel.addElement(locale);
      if (locale.equals(I18n.getCurrentLocale())) {
        languageComboBox.setSelectedItem(locale);
      }
    }
    languageComboBox.setRenderer(
        new DefaultListCellRenderer() {
          public Component getListCellRendererComponent(
              JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            Component comp =
                super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            JLabel label = new JLabel();
            label.setOpaque(false);
            if (isSelected) {
              label.setOpaque(true);
              label.setForeground(comp.getForeground());
              label.setBackground(comp.getBackground());
            } else {
              label.setBackground(comp.getBackground());
            }
            label.setBorder(BorderFactory.createEmptyBorder(3, 6, 3, 6));
            list.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
            list.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);

            Locale locale = (Locale) value;

            String languageNameForeign = WordUtils.capitalize(locale.getDisplayName(locale));
            String languageNameOwn =
                WordUtils.capitalize(locale.getDisplayName(I18n.getCurrentLocale()));
            String languageCode = locale.toString().replace("_", "-");

            // fix not existent language names
            if (locale.toString().equals("en_PT")) {
              languageNameForeign = "Pirate English";
              languageNameOwn = languageNameForeign;
            }
            if (locale.toString().equals("lol")) {
              languageNameForeign = "LOLCAT";
              languageNameOwn = languageNameForeign;
            }

            // fix ISO3 codes
            if (locale.toString().equals("iw")) {
              languageCode = "he";
            }

            URL url = getClass().getResource("/gui/flags/" + languageCode + ".png");
            if (url != null) {
              ImageIcon icon = new ImageIcon(url);
              icon = GuiUtils.stretchImage(icon, 18, 18, this);
              label.setIcon(icon);
            }

            label.setText(
                "<html>"
                    + "\u202A"
                    + languageNameForeign
                    + (!isSelected ? "<font color=gray>" : "")
                    + " — "
                    + languageNameOwn
                    + (!isSelected ? "</font>" : "")
                    + "</html>");

            return label;
          }
        });

    resetOriginalSettingsButton = new JButton(I18n.getLocaleString("RESET_ORIGINAL_SETTINGS"));
    resetOriginalSettingsButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            resetOriginalSettingsButtonActionPerformed(evt);
          }
        });

    fileExistsLabel = new JLabel();
    fileExistsLabel.setFont(new Font(fileExistsLabel.getFont().getName(), Font.BOLD, 11));
    fileExistsLabel.setText(I18n.getLocaleString("FILE_EXISTS"));

    fileExistsComboBox = new JComboBox();

    proxyHostLabel = new JLabel(I18n.getLocaleString("PROXY_HOST"));
    proxyHostLabel.setFont(new Font(proxyHostLabel.getFont().getName(), Font.BOLD, 11));

    proxyHostTextField = new JTextField();

    proxyPortLabel = new JLabel(I18n.getLocaleString("PROXY_PORT"));
    proxyPortLabel.setFont(new Font(proxyPortLabel.getFont().getName(), Font.BOLD, 11));

    proxyPortTextField = new JTextField();

    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.LEADING)
            .add(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.LEADING)
                            .add(
                                layout
                                    .createSequentialGroup()
                                    .add(
                                        resetOriginalSettingsButton,
                                        GroupLayout.PREFERRED_SIZE,
                                        227,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(LayoutStyle.RELATED)
                                    .add(
                                        saveSettingsButton,
                                        GroupLayout.PREFERRED_SIZE,
                                        250,
                                        GroupLayout.PREFERRED_SIZE))
                            .add(
                                layout
                                    .createSequentialGroup()
                                    .add(
                                        layout
                                            .createParallelGroup(GroupLayout.TRAILING, false)
                                            .add(
                                                languageLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .add(
                                                fileExistsLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .add(
                                                maxParallelDownloadsLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .add(
                                                filenameSchemeLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .add(
                                                downloadDirectoryLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .add(
                                                startTabLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .add(
                                                downloadCompletedLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .add(
                                                proxyHostLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .add(
                                                proxyPortLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE))
                                    .addPreferredGap(LayoutStyle.RELATED)
                                    .add(
                                        layout
                                            .createParallelGroup(GroupLayout.LEADING)
                                            .add(
                                                layout
                                                    .createSequentialGroup()
                                                    .add(downloadDirectoryTextField)
                                                    .addPreferredGap(LayoutStyle.RELATED)
                                                    .add(
                                                        downloadDirectoryButton,
                                                        GroupLayout.PREFERRED_SIZE,
                                                        48,
                                                        GroupLayout.PREFERRED_SIZE))
                                            .add(
                                                GroupLayout.TRAILING,
                                                filenameSchemeDescriptionLabel,
                                                GroupLayout.PREFERRED_SIZE,
                                                0,
                                                Short.MAX_VALUE)
                                            .add(GroupLayout.TRAILING, fileNameSchemeTextField)
                                            .add(
                                                layout
                                                    .createSequentialGroup()
                                                    .add(
                                                        layout
                                                            .createParallelGroup(
                                                                GroupLayout.LEADING, false)
                                                            .add(
                                                                downloadCompletedComboBox,
                                                                0,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                Short.MAX_VALUE)
                                                            .add(startTabComboBox)
                                                            .add(
                                                                maxParallelDownloadsSpinner,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                60,
                                                                GroupLayout.PREFERRED_SIZE)
                                                            .add(
                                                                fileExistsComboBox,
                                                                0,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                Short.MAX_VALUE)
                                                            .add(
                                                                languageComboBox,
                                                                0,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                Short.MAX_VALUE)
                                                            .add(proxyHostTextField)
                                                            .add(proxyPortTextField))
                                                    .add(0, 0, Short.MAX_VALUE)))))
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(GroupLayout.LEADING)
            .add(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(
                                downloadDirectoryTextField,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE)
                            .add(downloadDirectoryButton)
                            .add(
                                downloadDirectoryLabel,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE))
                    .addPreferredGap(LayoutStyle.UNRELATED)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.LEADING, false)
                            .add(maxParallelDownloadsSpinner)
                            .add(
                                maxParallelDownloadsLabel,
                                GroupLayout.PREFERRED_SIZE,
                                20,
                                GroupLayout.PREFERRED_SIZE))
                    .add(18, 18, 18)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(
                                filenameSchemeLabel,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .add(
                                fileNameSchemeTextField,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.RELATED)
                    .add(
                        filenameSchemeDescriptionLabel,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(LayoutStyle.UNRELATED)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(
                                startTabLabel,
                                GroupLayout.PREFERRED_SIZE,
                                23,
                                GroupLayout.PREFERRED_SIZE)
                            .add(startTabComboBox))
                    .add(18, 18, 18)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(downloadCompletedLabel)
                            .add(
                                downloadCompletedComboBox,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .add(15, 15, 15)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(fileExistsLabel)
                            .add(
                                fileExistsComboBox,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .add(18, 18, 18)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(languageLabel)
                            .add(
                                languageComboBox,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .add(18, 18, 18)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(proxyHostLabel)
                            .add(
                                proxyHostTextField,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .add(18, 18, 18)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(proxyPortLabel)
                            .add(
                                proxyPortTextField,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .add(50, 50, 50)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(saveSettingsButton)
                            .add(resetOriginalSettingsButton))
                    .addContainerGap()));

    setMinimumSize(new Dimension(700, 620));

    pack();
  }
  @Override
  public void stateChanged(ChangeEvent e) {
    PolygonRefineType refine = PolygonRefineType.values()[refineChoice.getSelectedIndex()];

    if (e.getSource() == spinnerMinEdge) {
      config.minimumEdgeIntensity = ((Number) spinnerMinEdge.getValue()).doubleValue();
    } else if (e.getSource() == spinnerMinSides) {
      minSides = ((Number) spinnerMinSides.getValue()).intValue();
      if (minSides > maxSides) {
        maxSides = minSides;
        spinnerMaxSides.setValue(minSides);
      }
      updateSidesInConfig();
    } else if (e.getSource() == spinnerMaxSides) {
      maxSides = ((Number) spinnerMaxSides.getValue()).intValue();
      if (maxSides < minSides) {
        minSides = maxSides;
        spinnerMinSides.setValue(minSides);
      }
      updateSidesInConfig();
    } else if (e.getSource() == selectZoom) {
      zoom = ((Number) selectZoom.getValue()).doubleValue();
      owner.viewUpdated();
      return;
    } else if (e.getSource() == spinnerMinContourSize) {
      config.minContourImageWidthFraction =
          ((Number) spinnerMinContourSize.getValue()).doubleValue();
    } else if (e.getSource() == spinnerContourSplit) {
      config.contour2Poly_splitFraction = ((Number) spinnerContourSplit.getValue()).doubleValue();
    } else if (e.getSource() == spinnerContourMinSplit) {
      config.contour2Poly_minimumSideFraction =
          ((Number) spinnerContourMinSplit.getValue()).doubleValue();
    } else if (e.getSource() == spinnerContourIterations) {
      config.contour2Poly_iterations = ((Number) spinnerContourIterations.getValue()).intValue();
    } else if (e.getSource() == spinnerSplitPenalty) {
      config.splitPenalty = ((Number) spinnerSplitPenalty.getValue()).doubleValue();
    } else if (e.getSource() == spinnerLineSamples) {
      if (refine == PolygonRefineType.LINE) {
        configLine.lineSamples = ((Number) spinnerLineSamples.getValue()).intValue();
      } else {
        configCorner.lineSamples = ((Number) spinnerLineSamples.getValue()).intValue();
      }
    } else if (e.getSource() == spinnerCornerOffset) {
      if (refine == PolygonRefineType.LINE) {
        configLine.cornerOffset = ((Number) spinnerCornerOffset.getValue()).intValue();
      } else {
        configCorner.cornerOffset = ((Number) spinnerCornerOffset.getValue()).intValue();
      }
    } else if (e.getSource() == spinnerSampleRadius) {
      if (refine == PolygonRefineType.LINE) {
        configLine.sampleRadius = ((Number) spinnerSampleRadius.getValue()).intValue();
      } else {
        configCorner.sampleRadius = ((Number) spinnerSampleRadius.getValue()).intValue();
      }
    } else if (e.getSource() == spinnerRefineMaxIterations) {
      if (refine == PolygonRefineType.LINE) {
        configLine.maxIterations = ((Number) spinnerRefineMaxIterations.getValue()).intValue();
      } else {
        configCorner.maxIterations = ((Number) spinnerRefineMaxIterations.getValue()).intValue();
      }
    } else if (e.getSource() == spinnerConvergeTol) {
      if (refine == PolygonRefineType.LINE) {
        configLine.convergeTolPixels = ((Number) spinnerConvergeTol.getValue()).doubleValue();
      } else {
        configCorner.convergeTolPixels = ((Number) spinnerConvergeTol.getValue()).doubleValue();
      }
    } else if (e.getSource() == spinnerMaxCornerChange) {
      if (refine == PolygonRefineType.LINE) {
        configLine.maxCornerChangePixel =
            ((Number) spinnerMaxCornerChange.getValue()).doubleValue();
      } else {
        configCorner.maxCornerChangePixel =
            ((Number) spinnerMaxCornerChange.getValue()).doubleValue();
      }
    }
    owner.configUpdate();
  }
  private void updateRefineSettings() {

    spinnerLineSamples.removeChangeListener(this);
    spinnerCornerOffset.removeChangeListener(this);
    spinnerSampleRadius.removeChangeListener(this);
    spinnerRefineMaxIterations.removeChangeListener(this);
    spinnerConvergeTol.removeChangeListener(this);
    spinnerMaxCornerChange.removeChangeListener(this);

    if (refineType == PolygonRefineType.LINE) {
      spinnerLineSamples.setValue(configLine.lineSamples);
      spinnerCornerOffset.setValue(configLine.cornerOffset);
      spinnerSampleRadius.setValue(configLine.sampleRadius);
      spinnerRefineMaxIterations.setValue(configLine.maxIterations);
      spinnerConvergeTol.setValue(configLine.convergeTolPixels);
      spinnerMaxCornerChange.setValue(configLine.maxCornerChangePixel);
    } else if (refineType == PolygonRefineType.CORNER) {
      spinnerLineSamples.setValue(configCorner.lineSamples);
      spinnerCornerOffset.setValue(configCorner.cornerOffset);
      spinnerSampleRadius.setValue(configCorner.sampleRadius);
      spinnerRefineMaxIterations.setValue(configCorner.maxIterations);
      spinnerConvergeTol.setValue(configCorner.convergeTolPixels);
      spinnerMaxCornerChange.setValue(configCorner.maxCornerChangePixel);
    }

    spinnerLineSamples.addChangeListener(this);
    spinnerCornerOffset.addChangeListener(this);
    spinnerSampleRadius.addChangeListener(this);
    spinnerRefineMaxIterations.addChangeListener(this);
    spinnerConvergeTol.addChangeListener(this);
    spinnerMaxCornerChange.addChangeListener(this);
  }
Exemplo n.º 30
0
  /**
   * Creates the video advanced settings.
   *
   * @return video advanced settings panel.
   */
  private static Component createVideoAdvancedSettings() {
    ResourceManagementService resources = NeomediaActivator.getResources();

    final DeviceConfiguration deviceConfig = mediaService.getDeviceConfiguration();

    TransparentPanel centerPanel = new TransparentPanel(new GridBagLayout());
    centerPanel.setMaximumSize(new Dimension(WIDTH, 150));

    JButton resetDefaultsButton =
        new JButton(resources.getI18NString("impl.media.configform.VIDEO_RESET"));
    JPanel resetButtonPanel = new TransparentPanel(new FlowLayout(FlowLayout.RIGHT));
    resetButtonPanel.add(resetDefaultsButton);

    final JPanel centerAdvancedPanel = new TransparentPanel(new BorderLayout());
    centerAdvancedPanel.add(centerPanel, BorderLayout.NORTH);
    centerAdvancedPanel.add(resetButtonPanel, BorderLayout.SOUTH);

    GridBagConstraints constraints = new GridBagConstraints();
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.insets = new Insets(5, 5, 0, 0);
    constraints.gridx = 0;
    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.gridy = 0;

    centerPanel.add(
        new JLabel(resources.getI18NString("impl.media.configform.VIDEO_RESOLUTION")), constraints);
    constraints.gridy = 1;
    constraints.insets = new Insets(0, 0, 0, 0);
    final JCheckBox frameRateCheck =
        new SIPCommCheckBox(resources.getI18NString("impl.media.configform.VIDEO_FRAME_RATE"));
    centerPanel.add(frameRateCheck, constraints);
    constraints.gridy = 2;
    constraints.insets = new Insets(5, 5, 0, 0);
    centerPanel.add(
        new JLabel(resources.getI18NString("impl.media.configform.VIDEO_PACKETS_POLICY")),
        constraints);

    constraints.weightx = 1;
    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.insets = new Insets(5, 0, 0, 5);
    Object[] resolutionValues = new Object[DeviceConfiguration.SUPPORTED_RESOLUTIONS.length + 1];
    System.arraycopy(
        DeviceConfiguration.SUPPORTED_RESOLUTIONS,
        0,
        resolutionValues,
        1,
        DeviceConfiguration.SUPPORTED_RESOLUTIONS.length);
    final JComboBox sizeCombo = new JComboBox(resolutionValues);
    sizeCombo.setRenderer(new ResolutionCellRenderer());
    sizeCombo.setEditable(false);
    centerPanel.add(sizeCombo, constraints);

    // default value is 20
    final JSpinner frameRate = new JSpinner(new SpinnerNumberModel(20, 5, 30, 1));
    frameRate.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            deviceConfig.setFrameRate(
                ((SpinnerNumberModel) frameRate.getModel()).getNumber().intValue());
          }
        });
    constraints.gridy = 1;
    constraints.insets = new Insets(0, 0, 0, 5);
    centerPanel.add(frameRate, constraints);

    frameRateCheck.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (frameRateCheck.isSelected()) {
              deviceConfig.setFrameRate(
                  ((SpinnerNumberModel) frameRate.getModel()).getNumber().intValue());
            } else // unlimited framerate
            deviceConfig.setFrameRate(-1);

            frameRate.setEnabled(frameRateCheck.isSelected());
          }
        });

    final JSpinner videoMaxBandwidth =
        new JSpinner(
            new SpinnerNumberModel(deviceConfig.getVideoMaxBandwidth(), 1, Integer.MAX_VALUE, 1));
    videoMaxBandwidth.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            deviceConfig.setVideoMaxBandwidth(
                ((SpinnerNumberModel) videoMaxBandwidth.getModel()).getNumber().intValue());
          }
        });
    constraints.gridx = 1;
    constraints.gridy = 2;
    constraints.insets = new Insets(0, 0, 5, 5);
    centerPanel.add(videoMaxBandwidth, constraints);

    resetDefaultsButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // reset to defaults
            sizeCombo.setSelectedIndex(0);
            frameRateCheck.setSelected(false);
            frameRate.setEnabled(false);
            frameRate.setValue(20);
            // unlimited framerate
            deviceConfig.setFrameRate(-1);
            videoMaxBandwidth.setValue(DeviceConfiguration.DEFAULT_VIDEO_MAX_BANDWIDTH);
          }
        });

    // load selected value or auto
    Dimension videoSize = deviceConfig.getVideoSize();

    if ((videoSize.getHeight() != DeviceConfiguration.DEFAULT_VIDEO_HEIGHT)
        && (videoSize.getWidth() != DeviceConfiguration.DEFAULT_VIDEO_WIDTH))
      sizeCombo.setSelectedItem(deviceConfig.getVideoSize());
    else sizeCombo.setSelectedIndex(0);
    sizeCombo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Dimension selectedVideoSize = (Dimension) sizeCombo.getSelectedItem();

            if (selectedVideoSize == null) {
              // the auto value, default one
              selectedVideoSize =
                  new Dimension(
                      DeviceConfiguration.DEFAULT_VIDEO_WIDTH,
                      DeviceConfiguration.DEFAULT_VIDEO_HEIGHT);
            }
            deviceConfig.setVideoSize(selectedVideoSize);
          }
        });

    frameRateCheck.setSelected(
        deviceConfig.getFrameRate() != DeviceConfiguration.DEFAULT_VIDEO_FRAMERATE);
    frameRate.setEnabled(frameRateCheck.isSelected());

    if (frameRate.isEnabled()) frameRate.setValue(deviceConfig.getFrameRate());

    return centerAdvancedPanel;
  }