public void focusLost(FocusEvent e) {
   Object source = e.getSource();
   if (source.equals(nameText)) {
     String text = nameText.getText();
     notifyListeners(text, false, STYLEEVENTTYPE.NAME);
   }
 }
Esempio n. 2
0
 public void focusLost(FocusEvent e) {
   int col = treeItem.getItemCount();
   Object source = e.getSource();
   if (source instanceof Text) {
     if (id >= col) return;
     DecimalFormat format = new DecimalFormat("0.000");
     String formatted = "";
     Text text = (Text) source;
     String textStr = text.getText();
     if (textStr.equals("") || textStr.equals("0")) {
       textStr = textBak;
     }
     double a, b, result;
     a = Double.parseDouble(textStr);
     for (int m = 0; m < id; m++) {
       String sTextStr = matrixText[m].getText();
       b = Double.parseDouble(sTextStr);
       result = a / b;
       //					result = b / a;
       formatted = format.format(result);
       System.out.println(
           "a " + a + " ;b " + b + " ;modified " + (m * col + id) + " ," + (id * col + m));
       matrixText[m * col + id].setText(formatted);
       result = b / a;
       //					result = a / b;
       formatted = format.format(result);
       matrixText[id * col + m].setText(formatted);
     }
   }
 }
Esempio n. 3
0
 public void focusGained(FocusEvent e) {
   Object source = e.getSource();
   if (source instanceof Text) {
     Text text = (Text) source;
     textBak = text.getText();
     text.selectAll();
   }
 }
Esempio n. 4
0
 public void focusGained(FocusEvent focusEvent) {
   LOGGER.debug("INVOKE");
   Object src = focusEvent.getSource();
   if (src == txtAbbrev) {
     LOGGER.debug("txtAbbrev = " + txtAbbrev.getText());
     txtAbbrev.selectAll();
   } else if (src == txtName) {
     txtName.selectAll();
   }
 }
 @Override
 public void focusLost(FocusEvent e) {
   Text text = (Text) e.getSource();
   String value = text.getText();
   if (value.isEmpty()) {
     text.setText(oldValue); // 元に戻す
   } else {
     if (!value.equals(oldValue)) {
       replace(value);
       oldValue = value;
     }
   }
 }
Esempio n. 6
0
    @Override
    public void focusLost(FocusEvent e) {
      if (actProblem == null) {
        return;
      }

      String oldvalue = actProblem.get(field);
      String newvalue = ((Text) e.getSource()).getText();
      if (oldvalue != null) {
        if (oldvalue.equals(newvalue)) {
          return;
        }
      }
      if (newvalue != null) {
        actProblem.set(field, newvalue);
      }
    }
Esempio n. 7
0
 public void focusLost(FocusEvent e) {
   int col = treeItem.getItemCount();
   Object source = e.getSource();
   if (source instanceof Text) {
     DecimalFormat format = new DecimalFormat("0.000");
     String formatted = "";
     Text text = (Text) source;
     String textStr = text.getText();
     if (textStr.equals("") || textStr.equals("0")) {
       textStr = textBak;
     }
     double a, result;
     a = Double.parseDouble(textStr);
     int c = id % col;
     int r = (id - c) / col;
     result = 1 / a;
     formatted = format.format(result);
     matrixText[c * col + r].setText(formatted);
   }
 }
 @Override
 public void focusGained(FocusEvent e) {
   Text text = (Text) e.getSource();
   oldValue = text.getText();
 }