Пример #1
0
  public EMonitoredTextField(int columns) {
    super(null, null, columns);
    getDocument()
        .addDocumentListener(
            new DocumentListener() {
              public void changedUpdate(DocumentEvent e) {
                textChanged();
              }

              public void insertUpdate(DocumentEvent e) {
                textChanged();
              }

              public void removeUpdate(DocumentEvent e) {
                textChanged();
              }
            });
    timer =
        new Timer(
            500,
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                timerExpired();
              }
            });
    timer.setRepeats(false);
  }
Пример #2
0
 static {
   caretTimer = new Timer(500, new CaretBlinker());
   caretTimer.setInitialDelay(500);
   caretTimer.start();
 }
Пример #3
0
 /** Restarts the timer every time the text changes. */
 public void textChanged() {
   timer.restart();
 }