コード例 #1
0
 private void setState(int newState) {
   String message = null;
   this.state = newState;
   switch (state) {
     case ParameterInputComponent.INPUT_IS_VALID:
       field.setBackground(ParameterInputComponent.BG_VALID);
       message = param.getDescription();
       getParentPanel().setMessage(message, Color.black);
       break;
     case ParameterInputComponent.INPUT_IS_OUT_OF_BOUNDS:
       field.setBackground(ParameterInputComponent.BG_INVALID);
       message =
           "Value for "
               + param.getID()
               + " must be between "
               + param.getMinValue()
               + " and "
               + param.getMaxValue()
               + ".";
       getParentPanel().setMessage(message, Color.red);
       break;
     case ParameterInputComponent.INPUT_IS_INCOMPREHENSIBLE:
       field.setBackground(ParameterInputComponent.BG_INVALID);
       message = "Value for " + param.getID() + " must be a valid integer.";
       getParentPanel().setMessage(message, Color.red);
       break;
     case ParameterInputComponent.INPUT_IS_REQUIRED_AND_EMPTY:
       field.setBackground(ParameterInputComponent.BG_INVALID);
       message = "Parameter " + param.getID() + " is required and " + "can not be empty.";
       getParentPanel().setMessage(message, Color.red);
   }
 }
コード例 #2
0
ファイル: DblCellEditor.java プロジェクト: bomm/thera-pi-2
  // This method is called when a cell value is edited by the user.
  public Component getTableCellEditorComponent(
      JTable table, Object value, boolean isSelected, int row, int column) {
    // Configure the component with the specified value
    if (!mitMaus) {
      ((JFormattedTextField) component).setText(String.valueOf(value));
      ((JFormattedTextField) component).selectAll();
      ((JFormattedTextField) component).setHorizontalAlignment(SwingConstants.RIGHT);
      ((JFormattedTextField) component).setBackground(Color.YELLOW);

    } else {
      final String xvalue = String.valueOf(value);
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              ((JFormattedTextField) component).setText(String.valueOf(xvalue).replace(".", ","));
              ((JFormattedTextField) component).selectAll();
              ((JFormattedTextField) component).setBackground(Color.YELLOW);
              ((JFormattedTextField) component).setHorizontalAlignment(SwingConstants.RIGHT);
              ((JFormattedTextField) component).setCaretPosition(0);
            }
          });
    }

    // Return the configured component
    //// System.out.println("I've been Called!!");
    return component;
  }
コード例 #3
0
ファイル: HostInfoPanel.java プロジェクト: 01org/opa-fmgui
  protected void enableCerts(boolean enable) {
    txtFldKeyStoreFile.setEnabled(enable);
    if (btnKeyStoreBrowser != null) {
      btnKeyStoreBrowser.setEnabled(enable);
    }
    txtFldTrustStoreFile.setEnabled(enable);
    if (btnTrustStoreBrowser != null) {
      btnTrustStoreBrowser.setEnabled(enable);
    }

    Color color = (enable) ? UIConstants.INTEL_WHITE : null;
    txtFldKeyStoreFile.setBackground(color);
    txtFldTrustStoreFile.setBackground(color);

    pnlSecurity.setVisible(enable);
  }
コード例 #4
0
ファイル: ExclusaoLote.java プロジェクト: jorgelob/producao
  public void acessaTecladoNumerico(
      JFormattedTextField campoAtual, JFormattedTextField proximoCampo) {

    if (Inicio.isMobile()) {
      campoAtual.setBackground(new Color(255, 255, 190));
      TelaTecladoNumerico tela = new TelaTecladoNumerico(null, true, campoAtual, proximoCampo);
      tela.setVisible(true);
    }
  }
コード例 #5
0
 private void updateRotationField(Double ra) {
   while (ra > 180) {
     ra -= 360;
   }
   while (ra < -180) {
     ra += 360;
   }
   rotationAngleField.setValue(ra);
   if (zeroRotationAngleBackground == null) {
     zeroRotationAngleBackground = rotationAngleField.getBackground();
   }
   if (ra > 0) {
     rotationAngleField.setBackground(positiveRotationAngleBackground);
   } else if (ra < 0) {
     rotationAngleField.setBackground(negativeRotationAngleBackground);
   } else {
     rotationAngleField.setBackground(zeroRotationAngleBackground);
   }
 }
コード例 #6
0
  @Override
  public Object stringToValue(String text) {
    Pattern pattern = getPattern();
    Matcher matcher = pattern.matcher(text);

    if (matcher.matches()) {
      setMatcher(matcher);
      // set text to be green
      dce.setForeground(foreground);
      dce.setBackground(backgound);

      return text;
    } else {
      // set text to be red when it's not correct
      dce.setForeground(warningForeground);
      dce.setBackground(warningBackground);

      if (discardOnInvalid) {
        return "";
      }

      return text;
    }
  }
コード例 #7
0
  /**
   * Creates a new IntegerInputComponent.
   *
   * @param param The IntegerParameter to be controlled.
   * @param parameterPanel The ParameterPanel to which this component is to be placed.
   */
  public IntegerInputComponent(IntegerParameter param, ParameterPanel parameterPanel) {
    super(parameterPanel);
    this.param = param;
    this.state = ParameterInputComponent.INPUT_IS_INITIALIZED;
    SpinnerModel model = new NullableSpinnerModel();
    model.setValue(param.getValue());
    this.spinner = new JSpinner(model);
    spinner.addFocusListener(this);
    spinner.setPreferredSize(ParameterInputComponent.PREFERRED_SIZE);

    // The second parameter of NumberEditor constructor is number format
    // The string "0" means that it is a digit without any thousand separators
    // or decimals
    spinner.setEditor(new NullableSpinnerEditor(spinner, "0"));

    spinner.addChangeListener(this);
    field = ((JSpinner.DefaultEditor) spinner.getEditor()).getTextField();
    field.addCaretListener(this);
    field.setBackground(BG_VALID);
    this.add(spinner, BorderLayout.CENTER);
  }
コード例 #8
0
ファイル: Report0.java プロジェクト: Amiri83/Mobtakeran
 public void setOK() {
   msisdnTextFeild.setBackground(Color.white);
   msisdnTextFeild.setText("");
 }
コード例 #9
0
ファイル: Report0.java プロジェクト: Amiri83/Mobtakeran
 public void setError() {
   msisdnTextFeild.setBackground(Color.red);
   msisdnTextFeild.setText("");
 }