当前位置: 首页>>代码示例>>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;未经允许,请勿转载。