Java Swing - O Reilly The following methods must be defined by implementations of this class: public abstract Object clone() Should return a copy of the editor kit. EditorKit implements Cloneable so that new instances can be created quickly. public abstract Caret createCaret() Should create a new Caret to be used with the JEditorPane. This method is currently not called anywhere within Swing Carets are initially installed via the createCaret() method in BasicTextUI, and can be reset via a call to setCaret() on any JTextComponent. public abstract Document createDefaultDocument() Called by the BasicTextUI when installing a UI for a component and by JTextComponentbefore loading a new document from a stream. It should return a new Document object of the appropriate type for the kit. Figure 24.2 shows how this method is called when a new JEditorPane is created without specifying a document. Figure 24.2. Default document creation using EditorKit public abstract void read(InputStream in, Document doc, int pos)throws IOException, BadLocationException public abstract void read(Reader in, Document doc, int pos)throws IOException, BadLocationException Should populate the given Document, based on data read from the stream or reader. The data read is inserted at the specified document position (use if this is a new, empty document). public abstract void write(OutputStream out, Document doc, int pos, int len) throws IOException, BadLocationException public abstract void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException Should write the specified portion of the document to the specified stream. To write the entire document, just call write(aWriter, aDoc, 0, aDoc.getLength()). - 790
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.