JTextPane - Make Caret Normal Size?
问题 So I am trying to make the text in a JTextPane double spaced. Here's my code: MutableAttributeSet attrs = editor.getInputAttributes(); StyleConstants.setLineSpacing(attrs, 2); editor.getStyledDocument().setParagraphAttributes(0, doc.getLength() + 1, attrs, true); The problem with this, is, the curser (caret) is as big as three or four line spaces. How can I resize the caret to normal size? Here is a screen snip 回答1: Try this: editor.setCaret(new DefaultCaret() { public void paint(Graphics g)