本文整理匯總了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);
}