@Override public void install(JEditorPane editor) { super.install(editor); editor.addKeyListener(this); }
@Override public void read(Reader in, Document doc, int pos) throws IOException, BadLocationException { super.read(in, doc, pos); // ((SyntaxDocument) doc).clearUndos(); }
/** Writes content from a document to the given stream */ public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException { if (doc instanceof BaseDocument) { ((BaseDocument) doc).write(out, pos, len); } else { super.write(out, doc, pos, len); } }
new FileOutputStream(tempFile)); try { new DefaultEditorKit().write(out, doc, 0, doc.getLength()); } catch (BadLocationException ble) { ble.printStackTrace();
public void actionPerformed(ActionEvent e) { new DefaultEditorKit().CutAction(); }
@Override public void deinstall(JEditorPane editor) { super.deinstall(editor); editor.removeKeyListener(this); }
private static EditorKit createEditorKit(String mimeType) { EditorKit kit; kit = JEditorPane.createEditorKitForContentType(mimeType); if (kit == null) { kit = new javax.swing.text.DefaultEditorKit(); } return kit; }
/** Set to a sane font (not proportional!). */ @Override public void install(JEditorPane pane) { super.install(pane); pane.setFont(new Font("Monospaced", Font.PLAIN, pane.getFont().getSize() + 1)); //NOI18N } }
/** Inserts content from the given stream. */ public void read(Reader in, Document doc, int pos) throws IOException, BadLocationException { if (doc instanceof BaseDocument) { ((BaseDocument) doc).read(in, pos); // delegate it to document } else { super.read(in, doc, pos); } }
/** Writes content from a document to the given stream */ public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException { if (doc instanceof BaseDocument) { ((BaseDocument)doc).write(out, pos, len); } else { super.write(out, doc, pos, len); } }
/** Set to a sane font (not proportional!). */ public void install (JEditorPane pane) { super.install (pane); pane.setFont (new Font ("Monospaced", Font.PLAIN, pane.getFont().getSize() + 1)); //NOI18N } }
/** Inserts content from the given stream. */ public void read(Reader in, Document doc, int pos) throws IOException, BadLocationException { if (doc instanceof BaseDocument) { ((BaseDocument)doc).read(in, pos); // delegate it to document } else { super.read(in, doc, pos); } }
/** Set to a sane font (not proportional!). */ public void install (JEditorPane pane) { super.install (pane); pane.setFont (new Font ("Monospaced", Font.PLAIN, pane.getFont().getSize() + 1)); //NOI18N } }
/** Overriden to set the JEditorPane font to match with the XMLContext * {@inheritDoc} */ public void install(JEditorPane c) { super.install(c); Object obj = context.getSyntaxFont(XMLContext.DEFAULT_STYLE); if (obj != null) { c.setFont((Font)obj); } }
/** Overriden to set the JEditorPane font to match with the XMLContext * {@inheritDoc} */ public void install(JEditorPane c) { super.install(c); Object obj = context.getSyntaxFont(XMLContext.DEFAULT_STYLE); if (obj != null) { c.setFont((Font)obj); } }
/** * Install the View on the given EditorPane. This is called by Swing and * can be used to do anything you need on the JEditorPane control. Here * I set some default Actions. * * @param editorPane */ @Override public void install(JEditorPane editorPane) { super.install(editorPane); // get our font String fontName = getProperty("DefaultFont"); Font font = DEFAULT_FONT; if (fontName != null) { font = Font.decode(fontName); } editorPane.setFont(font); Configuration conf = getConfig(); Color caretColor = conf.getColor(CONFIG_CARETCOLOR, Color.BLACK); editorPane.setCaretColor(caretColor); Color selectionColor = getConfig().getColor(CONFIG_SELECTION, new Color(0x99ccff)); editorPane.setSelectionColor(selectionColor); addActions(editorPane); addComponents(editorPane); addPopupMenu(editorPane); }
/** * Installs the View on the given EditorPane. This is called by Swing and * can be used to do anything you need on the JEditorPane control. Here * I set some default Actions. */ @Override public void install(JEditorPane editorPane) { super.install(editorPane); // get our font String fontName = getProperty("DefaultFont"); Font font = DEFAULT_FONT; if (fontName != null) { font = Font.decode(fontName); } editorPane.setFont(font); Configuration conf = getConfig(); Color caretColor = conf.getColor(CONFIG_CARETCOLOR, Color.BLACK); editorPane.setCaretColor(caretColor); Color selectionColor = getConfig().getColor(CONFIG_SELECTION, new Color(0x99ccff)); editorPane.setSelectionColor(selectionColor); addActions(editorPane); addComponents(editorPane); addPopupMenu(editorPane); }