Setting the Blink Rate of a JTextComponent's Caret - Java Swing

Java examples for Swing:JTextComponent

Description

Setting the Blink Rate of a JTextComponent's Caret

Demo Code

import javax.swing.JTextArea;
import javax.swing.text.JTextComponent;

public class Main {
  public static void main(String[] argv) throws Exception {
    JTextComponent c = new JTextArea();

    // Set rate to blink once a second
    c.getCaret().setBlinkRate(1000);// w w w  . j ava  2  s .c o m

    // Set the caret to stop blinking
    c.getCaret().setBlinkRate(0);
  }
}

Related Tutorials