Esempio n. 1
0
 private void setXAWTTextField(String txt) {
   text = txt;
   if (xtext != null) {
     // JTextField.setText() posts two different events (remove & insert).
     // Since we make no differences between text events,
     // the document listener has to be disabled while
     // JTextField.setText() is called.
     xtext.getDocument().removeDocumentListener(xtext);
     xtext.setText(txt);
     if (firstChangeSkipped) {
       postEvent(new TextEvent(target, TextEvent.TEXT_VALUE_CHANGED));
     }
     xtext.getDocument().addDocumentListener(xtext);
     xtext.setCaretPosition(0);
   }
 }
Esempio n. 2
0
 /**
  * to be implemented.
  *
  * @see java.awt.peer.TextComponentPeer
  */
 @Override
 public void setCaretPosition(int position) {
   if (xtext != null) xtext.setCaretPosition(position);
 }