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; }
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; }
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); }
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); }
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); }
editorPane.repaint(); editorPane.setEditable(true); htmlContents = null;
public void repaint() { if ((working & PAINT) != 0) { super.repaint(); } } }
@Override public void repaint() { if ((working & PAINT) != 0) { super.repaint(); } }
public void repaint() { if ((working & PAINT) != 0) { super.repaint(); } } }
public void breakpointModelChanged() { gutter.repaint(); editorPane.repaint(); }
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(); }
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 (); }
curr = e; pane.updateUI(); pane.repaint();
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(); } };
@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); }