本文整理了Java中javax.swing.JTextPane.setCaret()
方法的一些代码示例,展示了JTextPane.setCaret()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextPane.setCaret()
方法的具体详情如下:
包路径:javax.swing.JTextPane
类名称:JTextPane
方法名:setCaret
暂无
代码示例来源:origin: stackoverflow.com
JTextPane editor = new JTextPane();
DefaultCaret dc = new DefaultCaret() {
@Override
public void paint(Graphics g) {
if (isVisible()) {
JTextComponent comp = getComponent();
if (comp == null) {
return;
}
Rectangle r = null;
try {
r = comp.modelToView(getDot());
if (r == null) {
return;
}
} catch (BadLocationException e) {
return;
}
if (isVisible()) {
g.fillRect(r.x, r.y + 2, 1, r.height - 2);
}
}
}
};
dc.setBlinkRate(500);
editor.setCaret(dc);
代码示例来源:origin: otros-systems/otroslogviewer
loggerConfigTextPane.setText("Paste logback, log4j configuration files of just list of log patterns");
loggerConfigTextPane.setCaretColor(loggerConfigTextPane.getForeground());
loggerConfigTextPane.setCaret(new DefaultCaret());
loggerConfigTextPane.getDocument().addDocumentListener(new DocumentChangeListener(this::updatePatterns));
styledDocument = new DefaultStyledDocument();
内容来源于网络,如有侵权,请联系作者删除!