本文整理汇总了Java中javax.swing.JEditorPane.repaint方法的典型用法代码示例。如果您正苦于以下问题:Java JEditorPane.repaint方法的具体用法?Java JEditorPane.repaint怎么用?Java JEditorPane.repaint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JEditorPane
的用法示例。
在下文中一共展示了JEditorPane.repaint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupUI
import javax.swing.JEditorPane; //导入方法依赖的package包/类
private void setupUI(JEditorPane editorPane) {
EditorUI eui = org.netbeans.editor.Utilities.getEditorUI(editorPane);
if (eui == null) {
return;
}
editorPane.putClientProperty(
"HighlightsLayerExcludes", //NOI18N
"^org\\.netbeans\\.modules\\.editor\\.lib2\\.highlighting\\.CaretRowHighlighting$" //NOI18N
);
// Do not draw text limit line
try {
java.lang.reflect.Field textLimitLineField = EditorUI.class.getDeclaredField("textLimitLineVisible"); // NOI18N
textLimitLineField.setAccessible(true);
textLimitLineField.set(eui, false);
} catch (Exception ex) {}
editorPane.repaint();
}
示例2: mouseMoved
import javax.swing.JEditorPane; //导入方法依赖的package包/类
public void mouseMoved (MouseEvent e) {
JEditorPane c = (JEditorPane) e.getComponent ();
final NbEditorDocument doc = (NbEditorDocument) c.getDocument ();
if (highlight != null) highlight.remove ();
highlight = null;
runnable = null;
if (((e.getModifiers() | e.getModifiersEx()) & InputEvent.CTRL_DOWN_MASK) != InputEvent.CTRL_DOWN_MASK) {
return;
}
int offset = c.viewToModel (e.getPoint ());
highlight (doc, offset);
c.repaint ();
}
示例3: refreshPreview
import javax.swing.JEditorPane; //导入方法依赖的package包/类
@Override
public void refreshPreview() {
JEditorPane pane = (JEditorPane) getPreviewComponent();
try {
int rm = previewPrefs.getInt(rightMargin, getDefaultAsInt(rightMargin));
pane.putClientProperty("TextLimitLine", rm); //NOI18N
}
catch( NumberFormatException e ) {
// Ignore it
}
Rectangle visibleRectangle = pane.getVisibleRect();
pane.setText(previewText);
pane.setIgnoreRepaint(true);
final Document doc = pane.getDocument();
if (doc instanceof BaseDocument) {
final Reformat reformat = Reformat.get(doc);
reformat.lock();
try {
((BaseDocument) doc).runAtomic(new Runnable() {
@Override
public void run() {
try {
reformat.reformat(0, doc.getLength());
} catch (BadLocationException ble) {
LOGGER.log(Level.WARNING, null, ble);
}
}
});
} finally {
reformat.unlock();
}
} else {
LOGGER.warning(String.format("Can't format %s; it's not BaseDocument.", doc)); //NOI18N
}
pane.setIgnoreRepaint(false);
pane.scrollRectToVisible(visibleRectangle);
pane.repaint(100);
}