23 * questions. 24 */ 25 package javax.swing.text; 26 27 import java.io.*; 28 import javax.swing.Action; 29 import javax.swing.JEditorPane; 30 31 /** 32 * Establishes the set of things needed by a text component 33 * to be a reasonably functioning editor for some <em>type</em> 34 * of text content. The EditorKit acts as a factory for some 35 * kind of policy. For example, an implementation 36 * of html and rtf can be provided that is replaceable 37 * with other implementations. 38 * <p> 39 * A kit can safely store editing state as an instance 40 * of the kit will be dedicated to a text component. 41 * New kits will normally be created by cloning a 42 * prototype kit. The kit will have its 43 * <code>setComponent</code> method called to establish 44 * its relationship with a JTextComponent. 45 * 46 * @author Timothy Prinzing 47 */ 48 @SuppressWarnings("serial") // Same-version serialization only 49 public abstract class EditorKit implements Cloneable, Serializable { 50 51 /** 52 * Construct an EditorKit. 53 */ 54 public EditorKit() { 55 } 56 57 /** 58 * Creates a copy of the editor kit. This is implemented 59 * to use <code>Object.clone()</code>. If the kit cannot be cloned, 60 * null is returned. 61 * 62 * @return the copy 63 */ 64 public Object clone() { 65 Object o; 66 try { 67 o = super.clone(); 68 } catch (CloneNotSupportedException cnse) { 69 o = null; 70 } 71 return o; 72 } 73 74 /** 75 * Called when the kit is being installed into the 76 * a JEditorPane. 77 * 78 * @param c the JEditorPane 79 */ | 23 * questions. 24 */ 25 package javax.swing.text; 26 27 import java.io.*; 28 import javax.swing.Action; 29 import javax.swing.JEditorPane; 30 31 /** 32 * Establishes the set of things needed by a text component 33 * to be a reasonably functioning editor for some <em>type</em> 34 * of text content. The EditorKit acts as a factory for some 35 * kind of policy. For example, an implementation 36 * of html and rtf can be provided that is replaceable 37 * with other implementations. 38 * <p> 39 * A kit can safely store editing state as an instance 40 * of the kit will be dedicated to a text component. 41 * New kits will normally be created by cloning a 42 * prototype kit. The kit will have its 43 * {@code setComponent} method called to establish 44 * its relationship with a JTextComponent. 45 * 46 * @author Timothy Prinzing 47 */ 48 @SuppressWarnings("serial") // Same-version serialization only 49 public abstract class EditorKit implements Cloneable, Serializable { 50 51 /** 52 * Construct an EditorKit. 53 */ 54 public EditorKit() { 55 } 56 57 /** 58 * Creates a copy of the editor kit. This is implemented 59 * to use {@code Object.clone()}. If the kit cannot be cloned, 60 * null is returned. 61 * 62 * @return the copy 63 */ 64 public Object clone() { 65 Object o; 66 try { 67 o = super.clone(); 68 } catch (CloneNotSupportedException cnse) { 69 o = null; 70 } 71 return o; 72 } 73 74 /** 75 * Called when the kit is being installed into the 76 * a JEditorPane. 77 * 78 * @param c the JEditorPane 79 */ |