摘要:
1 import java.awt.Color; 2 import java.util.Set; 3 4 import javax.swing.JTextPane; 5 import javax.swing.SwingUtilities; 6 import javax.swing.event.DocumentEvent; 7 import javax.swing.event.DocumentListener; 8 import javax.swing.text.AttributeSet; 9 import javax.swing.text.BadLocationExcep... 阅读全文
摘要:
1 SimpleAttributeSet attributeSet = new SimpleAttributeSet();2 StyleConstants.setForeground(attributeSet, color);3 boolean replace = false;4 if (startPointer != endPointer) {5 StyledDocument doc = jTextPane.getStyledDocument();6 doc.setCharacte... 阅读全文