當前位置: 首頁>>代碼示例>>Java>>正文


Java JEditorPane.repaint方法代碼示例

本文整理匯總了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();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:ColumnModels.java

示例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 ();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:HyperlinkListener.java

示例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);

}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:43,代碼來源:FmtOptions.java


注:本文中的javax.swing.JEditorPane.repaint方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。