The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > javax.swing.text  [49 examples] > Caret and Selection  [3 examples]

e999. Setting the Blink Rate of a JTextComponent's Caret

The blink rate is specified in milliseconds. In particular, the blink rate causes the caret to appear for T milliseconds and disappear for T milliseconds.
    JTextComponent c = new JTextArea();
    
    // Set rate to blink once a second
    c.getCaret().setBlinkRate(1000);
    
    // Set the caret to stop blinking
    c.getCaret().setBlinkRate(0);

 Related Examples
e998. Moving the Caret of a JTextComponent
e1000. Using the Selection of a JTextComponent

See also: Actions and Key Bindings    Events    JEditorPane    JFormattedTextField    JTextArea    JTextComponent    JTextField    JTextPane    Styles   


© 2002 Addison-Wesley.