javax.swing.JEditorPane.repaint()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中javax.swing.JEditorPane.repaint()方法的一些代码示例,展示了JEditorPane.repaint()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JEditorPane.repaint()方法的具体详情如下:
包路径:javax.swing.JEditorPane
类名称:JEditorPane
方法名:repaint

JEditorPane.repaint介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

private void clearDocument() {
 editorPane.setContentType("text/rtf");
 Document doc = new DefaultStyledDocument();
 editorPane.setDocument(doc);
 //    defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes();
 //    StyleConstants.setFontFamily(defaultAttrSet, "Lucinda Sans Unicode");
 log.info("attr: "+defaultAttrSet);
 try {
  doc.insertString(0, " ", defaultAttrSet);
 } catch (Exception ex) {
  throw new RuntimeException(ex);
 }
 editorPane.setEditable(true);
 editorPane.revalidate();
 editorPane.repaint();
 saveUntagged.setEnabled(false);
 saveTaggedAs.setEnabled(false);
 taggedContents = null;
 htmlContents = null;
 loadedFile = null;
}

代码示例来源:origin: stanfordnlp/CoreNLP

public void clearDocument() {
 editorPane.setContentType("text/rtf");
 Document doc = new DefaultStyledDocument();
 editorPane.setDocument(doc);
 //    defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes();
 //    StyleConstants.setFontFamily(defaultAttrSet, "Lucinda Sans Unicode");
 log.info("attr: "+defaultAttrSet);
 try {
  doc.insertString(0, " ", defaultAttrSet);
 } catch (Exception ex) {
  throw new RuntimeException(ex);
 }
 editorPane.setEditable(true);
 editorPane.revalidate();
 editorPane.repaint();
 saveUntagged.setEnabled(false);
 saveTaggedAs.setEnabled(false);
 taggedContents = null;
 untaggedContents = null;
 htmlContents = null;
 loadedFile = null;
}

代码示例来源:origin: stanfordnlp/CoreNLP

public void redraw() {
 String text = editorPane.getText();
 taggedContents = null;
 untaggedContents = null;
 if (!editorPane.getContentType().equals("text/html")) {
  editorPane.setContentType("text/rtf");
  Document doc = editorPane.getDocument();
  try {
   doc.insertString(0, text, defaultAttrSet);
  } catch (Exception e) {
   throw new RuntimeException(e);
  }
  editorPane.revalidate();
  editorPane.repaint();
  editorPane.setEditable(true);
  htmlContents = null;
 } else {
  editorPane.setEditable(false);
  htmlContents = editorPane.getText();
 }
 saveUntagged.setEnabled(false);
 saveTaggedAs.setEnabled(false);
}

代码示例来源:origin: stanfordnlp/CoreNLP

private void removeTags() {
 if (editorPane.getContentType().equals("text/html")) {
  editorPane.setText(htmlContents);
  editorPane.revalidate();
  editorPane.repaint();
 } else {
  DefaultStyledDocument doc = (DefaultStyledDocument)editorPane.getDocument();
  SimpleAttributeSet attr = new SimpleAttributeSet();
  StyleConstants.setForeground(attr, Color.BLACK);
  StyleConstants.setBackground(attr, Color.WHITE);
  doc.setCharacterAttributes(0, doc.getLength(), attr, false);
 }
 saveTaggedAs.setEnabled(false);
}

代码示例来源:origin: stanfordnlp/CoreNLP

editorPane.repaint();
} else {
 untaggedContents = editorPane.getText();
 editorPane.setText(finalText);
 editorPane.revalidate();
 editorPane.repaint();

代码示例来源:origin: stanfordnlp/CoreNLP

private void removeTags() {
 if (editorPane.getContentType().equals("text/html")) {
  if (htmlContents != null) {
   editorPane.setText(htmlContents);
  }
  editorPane.revalidate();
  editorPane.repaint();
 } else {
  DefaultStyledDocument doc = (DefaultStyledDocument)editorPane.getDocument();
  SimpleAttributeSet attr = new SimpleAttributeSet();
  StyleConstants.setForeground(attr, Color.BLACK);
  StyleConstants.setBackground(attr, Color.WHITE);
  doc.setCharacterAttributes(0, doc.getLength(), attr, false);
 }
 saveTaggedAs.setEnabled(false);
}

代码示例来源:origin: stanfordnlp/CoreNLP

editorPane.repaint();
} else {
 String untaggedContents = editorPane.getText();
 editorPane.repaint();

代码示例来源:origin: stanfordnlp/CoreNLP

editorPane.repaint();
editorPane.setEditable(true);
htmlContents = null;

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public void repaint() {
    if ((working & PAINT) != 0) {
      super.repaint();
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-text

@Override
public void repaint() {
  if ((working & PAINT) != 0) {
    super.repaint();
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public void repaint() {
    if ((working & PAINT) != 0) {
      super.repaint();
    }
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

public void breakpointModelChanged() {
  gutter.repaint();
  editorPane.repaint();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javascript2-debug-ui

private static void setupUI(final JEditorPane editorPane) {
  assert SwingUtilities.isEventDispatchThread();
  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();
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-languages

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 ();
}

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

curr = e;
pane.updateUI();
pane.repaint();

代码示例来源:origin: stackoverflow.com

MouseListener sentenceCollapse = new MouseAdapter() {
  public void mouseClicked(MouseEvent e) {
    JEditorPane src = (JEditorPane)e.getSource();
    View v = src.getUI().getRootView(src);
    Insets ins = src.getInsets();
    int x = ins.left;
    int y = ins.top;
    Point p = e.getPoint();
    p.translate(-x, -y);
    Rectangle alloc = new Rectangle(0,0,Short.MAX_VALUE,Short.MAX_VALUE);

    while (v != null && !(v instanceof SentenceView)) {
      View vChild = null;
      int n = v.getViewCount();
      for (int i = 0; i < n; i++) {
        Rectangle r = v.getChildAllocation(i, alloc).getBounds();

        if (r.contains(p)) {
          vChild = v.getView(i); 
          alloc = (Rectangle) r.clone();
        }
      }
      v = vChild;
    }
    if (v != null && v instanceof SentenceView) {
    <<< unfold or fold the Sentence View >>>
    src.repaint();
  }
};

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

editorPane.repaint();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-editor

@Override
public void refreshPreview() {
  JEditorPane jep = (JEditorPane) getPreviewComponent();
  try {
    int rm = previewPrefs.getInt(rightMargin, getDefaultAsInt(rightMargin));
    jep.putClientProperty("TextLimitLine", rm); //NOI18N
  }
  catch( NumberFormatException e ) {
    // Ignore it
  }
  jep.setIgnoreRepaint(true);
  jep.setText(previewText);
  
  final BaseDocument bd = (BaseDocument)jep.getDocument();
  final FortranCodeStyle codeStyle = FortranCodeStyle.get(bd, previewPrefs);
  codeStyle.setupLexerAttributes(bd);
  bd.runAtomicAsUser(new Runnable() {
    @Override
    public void run() {
      try {
        new FortranReformatter(bd, codeStyle).reformat();
      } catch (BadLocationException ex) {
        Exceptions.printStackTrace(ex);
      }
    }
  });
  jep.setIgnoreRepaint(false);
  jep.scrollRectToVisible(new Rectangle(0,0,10,10) );
  jep.repaint(100);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby

jep.repaint(100);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor

pane.repaint(100);

相关文章

JEditorPane类方法