List of usage examples for javax.swing.text JTextComponent setCaretColor
@BeanProperty(preferred = true, description = "the color used to render the caret") public void setCaretColor(Color c)
From source file:Main.java
public static void main(String[] argv) throws Exception { JTextComponent c = new JTextArea(); c.getCaretPosition();//from ww w . j a v a 2 s.c o m if (c.getCaretPosition() < c.getDocument().getLength()) { char ch = c.getText(c.getCaretPosition(), 1).charAt(0); } // Set the caret color c.setCaretColor(Color.red); }