There are several goals of the HTML EditorKit provided, that have an effect upon the way that HTML is modeled. These have influenced its design in a substantial way.
The modeling of HTML is provided by the class HTMLDocument.
Its documentation describes the details of how the HTML is modeled.
The editing support leverages heavily off of the text package.
HTMLFactory class. This can
be easily changed by subclassing or replacing the HTMLFactory
and reimplementing the getViewFactory method to return the alternative
factory.
JEditorPane.setPage.
This is controlled by a property on the document. The method
createDefaultDocument can
be overridden to change this. The batching of work is done
by the HTMLDocument.HTMLReader class. The actual
work is done by the DefaultStyledDocument and
AbstractDocument classes in the text package.
The support for this is provided by the StyleSheet
class. The presentation of the HTML can be heavily influenced
by the setting of the StyleSheet property on the EditorKit.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | |
| pack-priv static class | |
| public static class | HTMLEditorKit.
A factory to build views for HTML. |
| public abstract static class | HTMLEditorKit.
An abstract Action providing some convenience methods that may be useful in inserting HTML into an existing document. |
| pack-priv static class | HTMLEditorKit.
InsertHRAction is special, at actionPerformed time it will determine the parent HTML.Tag based on the paragraph element at the selection start. |
| public static class | HTMLEditorKit.
InsertHTMLTextAction can be used to insert an arbitrary string of HTML into an existing HTML document. |
| public static class | HTMLEditorKit.
Class to watch the associated component and fire hyperlink events on it when appropriate. |
| pack-priv static class | |
| public abstract static class | HTMLEditorKit.
Interface to be supported by the parser. |
| public static class | HTMLEditorKit.
The result of parsing drives these callback methods. |
| Modifier and Type | Field and Description |
|---|---|
| private AccessibleContext | |
| private static final HTMLEditorKit. | |
| public static final String | BOLD_ACTION
The bold action identifier |
| public static final String | COLOR_ACTION
The Color choice action identifier The color is passed as an argument |
| public static final String | DEFAULT_CSS
Default Cascading Style Sheet file that sets up the tag views. |
| private static final Object | |
| private static final Action[] | |
| private static final Cursor | |
| private Cursor | |
| private static final ViewFactory | defaultFactory
Shared factory for creating HTML Views.
|
| private static HTMLEditorKit. | |
| private static StyleSheet | |
| public static final String | FONT_CHANGE_BIGGER
The font size increase to next value action identifier |
| public static final String | FONT_CHANGE_SMALLER
The font size decrease to next value action identifier |
| private boolean | |
| public static final String | IMG_ALIGN_BOTTOM
Align images at the bottom. |
| public static final String | IMG_ALIGN_MIDDLE
Align images in the middle. |
| public static final String | IMG_ALIGN_TOP
Align images at the top. |
| public static final String | IMG_BORDER
Align images at the border. |
| pack-priv MutableAttributeSet | |
| private static final String | INSERT_HR_HTML
HTML used when inserting hr. |
| private static final String | INSERT_OL_HTML
HTML used when inserting ordered lists. |
| private static final String | INSERT_PRE_HTML
HTML used when inserting pre. |
| private static final String | INSERT_TABLE_HTML
HTML used when inserting tables. |
| private static final String | INSERT_UL_HTML
HTML used when inserting unordered lists. |
| private boolean | |
| public static final String | ITALIC_ACTION
The italic action identifier |
| private Cursor | |
| private HTMLEditorKit. | |
| private Object | |
| public static final String | LOGICAL_STYLE_ACTION
The logical style choice action identifier The logical style is passed in as an argument |
| private static final Cursor | |
| private static final HTMLEditorKit. | |
| public static final String | PARA_INDENT_LEFT
The paragraph left indent action identifier |
| public static final String | PARA_INDENT_RIGHT
The paragraph right indent action identifier |
| private int | |
| private static final HTMLEditorKit. | |
| private JEditorPane |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Object | Returns: the copyOverrides javax. Creates a copy of the editor kit. |
| public Document | Returns: the modelOverrides javax. Create an uninitialized text storage model that is appropriate for this type of editor. |
| protected void | createInputAttributes(Element element, MutableAttributeSet set)
Overrides javax. Copies the key/values in |
| public void | deinstall(JEditorPane
the JEditorPane c)Overrides javax. Called when the kit is being removed from the JEditorPane. |
| private HTMLEditorKit. | |
| public AccessibleContext | Returns: the AccessibleContext associated with this editor kitImplements javax. returns the AccessibleContext associated with this editor kit |
| public Action[] | Returns: the command listOverrides javax. Fetches the command list for the editor. |
| private static Object | |
| private static int | |
| public String | Returns: the typeOverrides javax. Get the MIME type of the data that this kit represents support for. |
| public Cursor | |
| public MutableAttributeSet | Returns: the attribute setOverrides javax. Gets the input attributes used for the styled editing actions. |
| public Cursor | |
| protected HTMLEditorKit. | |
| pack-priv static InputStream | Returns: a stream representing the resourcethe name of the resource, relative to the
HTMLEditorKit class name)Fetch a resource relative to the HTMLEditorKit classfile. |
| public StyleSheet | Returns: the StyleSheetGet the set of styles currently being used to render the HTML elements. |
| public ViewFactory | Returns: the factoryOverrides javax. Fetch a factory that is suitable for producing views of any models that are produced by this kit. |
| public void | insertHTML(HTMLDocument
the document to insert into doc, int the offset to insert HTML at offset, String the HTML string html, int the number of ElementSpec.EndTagTypes to generate
before inserting popDepth, int the number of ElementSpec.StartTagTypes with a direction
of ElementSpec.JoinNextDirection that should be generated
before inserting, but after the end tags have been generated pushDepth, HTML.the first tag to start inserting into document insertTagInserts HTML into an existing document. |
| public void | install(JEditorPane
the JEditorPane c)Overrides javax. Called when the kit is being installed into the a JEditorPane. |
| public boolean | Returns: true if html form submission is processed automatically, false otherwise.Indicates whether an html form submission is processed automatically
or only |
| public void | read(Reader
the stream to read from in, Document the destination for the insertion doc, int the location in the document to place the
content pos)Overrides javax. Inserts content from the given stream. |
| public void | setAutoFormSubmission(boolean
if isAuto)true, html form submission is processed automatically.Specifies if an html form submission is processed
automatically or only |
| public void | |
| public void | |
| public void | setStyleSheet(StyleSheet
a StyleSheet s)Set the set of styles to be used to render the various HTML elements. |
| public void | write(Writer
the stream to write to out, Document the source for the write doc, int the location in the document to fetch the
content pos, int the amount to write out len)Overrides javax. Write content from a document to the given stream in a format appropriate for this kind of content handler. |