Esempio n. 1
0
  public XTextField(
      Object value,
      Class<?> expectedClass,
      int colWidth,
      boolean isCallable,
      JButton button,
      XOperations operation) {
    super(new BorderLayout());
    this.button = button;
    this.operation = operation;
    add(textField = new JTextField(value.toString(), colWidth), BorderLayout.CENTER);
    if (isCallable) textField.addActionListener(this);

    boolean fieldEditable = Utils.isEditableType(expectedClass.getName());
    if (fieldEditable && isCallable) {
      textField.setEditable(true);
    } else {
      textField.setEditable(false);
    }
  }
Esempio n. 2
0
  protected void init(Object value, Class<?> expectedClass) {
    boolean fieldEditable = Utils.isEditableType(expectedClass.getName());
    clearObject();
    if (value != null) {
      textField.setText(value.toString());
    } else {
      // null String value for the moment
      textField.setText("");
    }
    textField.setToolTipText(null);
    if (fieldEditable) {
      if (!textField.isEditable()) {
        textField.setEditable(true);
      }

    } else {
      if (textField.isEditable()) {
        textField.setEditable(false);
      }
    }
  }