public class HTMLEditorKit extends javax.swing.text.StyledEditorKit implements java.io.Serializable, java.lang.Cloneable, javax.accessibility.Accessible
| Modifier and Type | Class and Description |
|---|---|
static class |
HTMLEditorKit.HTMLFactory
A
ViewFactory that is able to create Views for
the Elements that are supported. |
static class |
HTMLEditorKit.HTMLTextAction
Abstract Action class that helps inserting HTML into an existing document.
|
static class |
HTMLEditorKit.InsertHTMLTextAction
This class is used to insert a string of HTML into an existing
document.
|
static class |
HTMLEditorKit.LinkController
Fires the hyperlink events on the associated component
when needed.
|
static class |
HTMLEditorKit.Parser
The abstract HTML parser declaration.
|
static class |
HTMLEditorKit.ParserCallback
The "hook" that receives all information about the HTML document
structure while parsing it.
|
javax.swing.text.StyledEditorKit.AlignmentAction, javax.swing.text.StyledEditorKit.BoldAction, javax.swing.text.StyledEditorKit.FontFamilyAction, javax.swing.text.StyledEditorKit.FontSizeAction, javax.swing.text.StyledEditorKit.ForegroundAction, javax.swing.text.StyledEditorKit.ItalicAction, javax.swing.text.StyledEditorKit.StyledTextAction, javax.swing.text.StyledEditorKit.UnderlineActionjavax.swing.text.DefaultEditorKit.BeepAction, javax.swing.text.DefaultEditorKit.CopyAction, javax.swing.text.DefaultEditorKit.CutAction, javax.swing.text.DefaultEditorKit.DefaultKeyTypedAction, javax.swing.text.DefaultEditorKit.InsertBreakAction, javax.swing.text.DefaultEditorKit.InsertContentAction, javax.swing.text.DefaultEditorKit.InsertTabAction, javax.swing.text.DefaultEditorKit.PasteAction| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
BOLD_ACTION
The bold action identifier.
|
static java.lang.String |
COLOR_ACTION
The color action indentifier
(passing the color as an argument).
|
static java.lang.String |
DEFAULT_CSS
Default cascading stylesheed file ("default.css").
|
static java.lang.String |
FONT_CHANGE_BIGGER
The increase font action identifier.
|
static java.lang.String |
FONT_CHANGE_SMALLER
The decrease font action identifier.
|
static java.lang.String |
IMG_ALIGN_BOTTOM
Align images at the bottom.
|
static java.lang.String |
IMG_ALIGN_MIDDLE
Align images at the middle.
|
static java.lang.String |
IMG_ALIGN_TOP
Align images at the top.
|
static java.lang.String |
IMG_BORDER
Align images at the border.
|
static java.lang.String |
ITALIC_ACTION
The italic action identifier.
|
static java.lang.String |
LOGICAL_STYLE_ACTION
The "logical style" action identifier, passing that style as parameter.
|
static java.lang.String |
PARA_INDENT_LEFT
The "ident paragraph left" action.
|
static java.lang.String |
PARA_INDENT_RIGHT
The "ident paragraph right" action.
|
backwardAction, beepAction, beginAction, beginLineAction, beginParagraphAction, beginWordAction, copyAction, cutAction, defaultKeyTypedAction, deleteNextCharAction, deletePrevCharAction, downAction, endAction, endLineAction, EndOfLineStringProperty, endParagraphAction, endWordAction, forwardAction, insertBreakAction, insertContentAction, insertTabAction, nextWordAction, pageDownAction, pageUpAction, pasteAction, previousWordAction, readOnlyAction, selectAllAction, selectionBackwardAction, selectionBeginAction, selectionBeginLineAction, selectionBeginParagraphAction, selectionBeginWordAction, selectionDownAction, selectionEndAction, selectionEndLineAction, selectionEndParagraphAction, selectionEndWordAction, selectionForwardAction, selectionNextWordAction, selectionPreviousWordAction, selectionUpAction, selectLineAction, selectParagraphAction, selectWordAction, upAction, writableAction| Constructor and Description |
|---|
HTMLEditorKit()
Constructs an HTMLEditorKit, creates a StyleContext, and loads the style sheet.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
Creates a copy of the editor kit.
|
javax.swing.text.Document |
createDefaultDocument()
Create a text storage model for this type of editor.
|
protected void |
createInputAttributes(javax.swing.text.Element element,
javax.swing.text.MutableAttributeSet set)
Copies the key/values in elements AttributeSet into set.
|
void |
deinstall(javax.swing.JEditorPane c)
Called when the this is removed from the JEditorPane.
|
javax.accessibility.AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this.
|
javax.swing.Action[] |
getActions()
Gets the action list.
|
java.lang.String |
getContentType()
Gets the content type that the kit supports.
|
java.awt.Cursor |
getDefaultCursor()
Returns the default cursor.
|
javax.swing.text.MutableAttributeSet |
getInputAttributes()
Gets the input attributes used for the styled editing actions.
|
java.awt.Cursor |
getLinkCursor()
Returns the cursor for links.
|
protected HTMLEditorKit.Parser |
getParser()
Get the parser that this editor kit uses for reading HTML streams.
|
StyleSheet |
getStyleSheet()
Get the set of styles currently being used to render the HTML elements.
|
javax.swing.text.ViewFactory |
getViewFactory()
Gets a factory suitable for producing views of any
models that are produced by this kit.
|
void |
insertHTML(HTMLDocument doc,
int offset,
java.lang.String html,
int popDepth,
int pushDepth,
HTML.Tag insertTag)
Inserts HTML into an existing document.
|
void |
install(javax.swing.JEditorPane c)
Called when this is installed into the JEditorPane.
|
boolean |
isAutoFormSubmission()
Returns
true when forms should be automatically submitted
by the editor kit. |
void |
read(java.io.Reader in,
javax.swing.text.Document doc,
int pos)
Inserts content from the given stream.
|
void |
setAutoFormSubmission(boolean auto)
Sets whether or not the editor kit should automatically submit forms.
|
void |
setDefaultCursor(java.awt.Cursor cursor)
Sets the default cursor.
|
void |
setLinkCursor(java.awt.Cursor cursor)
Sets the Cursor for links.
|
void |
setStyleSheet(StyleSheet s)
Set the set of styles to be used to render the various HTML elements.
|
void |
write(java.io.Writer out,
javax.swing.text.Document doc,
int pos,
int len)
Writes content from a document to the given stream in
an appropriate format.
|
public static final java.lang.String DEFAULT_CSS
public static final java.lang.String BOLD_ACTION
public static final java.lang.String ITALIC_ACTION
public static final java.lang.String COLOR_ACTION
public static final java.lang.String FONT_CHANGE_BIGGER
public static final java.lang.String FONT_CHANGE_SMALLER
public static final java.lang.String IMG_ALIGN_BOTTOM
public static final java.lang.String IMG_ALIGN_MIDDLE
public static final java.lang.String IMG_ALIGN_TOP
public static final java.lang.String IMG_BORDER
public static final java.lang.String LOGICAL_STYLE_ACTION
public static final java.lang.String PARA_INDENT_LEFT
public static final java.lang.String PARA_INDENT_RIGHT
public HTMLEditorKit()
public javax.swing.text.ViewFactory getViewFactory()
getViewFactory in class javax.swing.text.StyledEditorKitpublic javax.swing.text.Document createDefaultDocument()
createDefaultDocument in class javax.swing.text.StyledEditorKitprotected HTMLEditorKit.Parser getParser()
ParserDelegator).public void insertHTML(HTMLDocument doc, int offset, java.lang.String html, int popDepth, int pushDepth, HTML.Tag insertTag) throws javax.swing.text.BadLocationException, java.io.IOException
doc - - the Document to insert the HTML into.offset - - where to begin inserting the HTML.html - - the String to insertpopDepth - - the number of ElementSpec.EndTagTypes
to generate before insertingpushDepth - - the number of ElementSpec.StartTagTypes
with a direction of ElementSpec.JoinNextDirection that
should be generated beforeinsertTag - - the first tag to start inserting into documentjava.io.IOException - - on any I/O errorjavax.swing.text.BadLocationException - - if pos represents an invalid location
within the documentpublic void read(java.io.Reader in, javax.swing.text.Document doc, int pos) throws java.io.IOException, javax.swing.text.BadLocationException
read in class javax.swing.text.DefaultEditorKitin - - the stream to read fromdoc - - the destination for the insertionpos - - the location in the document to place the contentjava.io.IOException - - on any I/O errorjavax.swing.text.BadLocationException - - if pos represents an invalid location
within the documentpublic void write(java.io.Writer out, javax.swing.text.Document doc, int pos, int len) throws java.io.IOException, javax.swing.text.BadLocationException
write in class javax.swing.text.DefaultEditorKitout - - the stream to write todoc - - the source for the writepos - - the location in the document to get the content.len - - the amount to write outjava.io.IOException - - on any I/O errorjavax.swing.text.BadLocationException - - if pos represents an invalid location
within the documentpublic java.lang.String getContentType()
getContentType in class javax.swing.text.DefaultEditorKitEditorKit supportspublic java.lang.Object clone()
clone in class javax.swing.text.StyledEditorKitCloneableprotected void createInputAttributes(javax.swing.text.Element element, javax.swing.text.MutableAttributeSet set)
createInputAttributes in class javax.swing.text.StyledEditorKitelement - - the element to create the input attributes for.set - - the set to copy the values into.public void install(javax.swing.JEditorPane c)
install in class javax.swing.text.StyledEditorKitc - - the JEditorPane installed into.public void deinstall(javax.swing.JEditorPane c)
deinstall in class javax.swing.text.StyledEditorKitc - - the JEditorPane being removed from.public javax.accessibility.AccessibleContext getAccessibleContext()
getAccessibleContext in interface javax.accessibility.Accessiblepublic javax.swing.Action[] getActions()
getActions in class javax.swing.text.StyledEditorKitpublic java.awt.Cursor getDefaultCursor()
public java.awt.Cursor getLinkCursor()
public void setLinkCursor(java.awt.Cursor cursor)
cursor - - the new cursor for links.public void setDefaultCursor(java.awt.Cursor cursor)
cursor - - the new default cursor.public javax.swing.text.MutableAttributeSet getInputAttributes()
getInputAttributes in class javax.swing.text.StyledEditorKitpublic StyleSheet getStyleSheet()
public void setStyleSheet(StyleSheet s)
s - - the new style sheetpublic boolean isAutoFormSubmission()
true when forms should be automatically submitted
by the editor kit. Set this to false when you want to
intercept form submission. In this case you'd want to listen for
hyperlink events on the document and handle FormSubmitEvents specially.
The default is true.true when forms should be automatically submitted
by the editor kit, false otherwisesetAutoFormSubmission(boolean),
FormSubmitEventpublic void setAutoFormSubmission(boolean auto)
auto - true when the editor kit should handle form
submission, false otherwiseisAutoFormSubmission()