Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
javax.swing.text.EditorKit
javax.swing.text.DefaultEditorKit
javax.swing.text.StyledEditorKit
javax.swing.text.html.HTMLEditorKit
Nested Class Summary | |
static class |
|
static class |
|
static class |
|
static class |
|
static class |
|
static class |
|
Nested classes/interfaces inherited from class javax.swing.text.StyledEditorKit | |
StyledEditorKit.AlignmentAction , StyledEditorKit.BoldAction , StyledEditorKit.FontFamilyAction , StyledEditorKit.FontSizeAction , StyledEditorKit.ForegroundAction , StyledEditorKit.ItalicAction , StyledEditorKit.StyledTextAction , StyledEditorKit.UnderlineAction |
Nested classes/interfaces inherited from class javax.swing.text.DefaultEditorKit | |
DefaultEditorKit.BeepAction , DefaultEditorKit.CopyAction , DefaultEditorKit.CutAction , DefaultEditorKit.DefaultKeyTypedAction , DefaultEditorKit.InsertBreakAction , DefaultEditorKit.InsertContentAction , DefaultEditorKit.InsertTabAction , DefaultEditorKit.PasteAction |
Field Summary | |
static String |
|
static String |
|
static String |
|
static String |
|
static String |
|
static String |
|
static String |
|
static String |
|
static String |
|
static String |
|
static String |
|
static String |
|
static String |
|
Constructor Summary | |
|
Method Summary | |
Object |
|
Document |
|
protected void |
|
void |
|
AccessibleContext |
|
Action[] |
|
String |
|
Cursor |
|
MutableAttributeSet |
|
Cursor |
|
protected HTMLEditorKit.Parser |
|
StyleSheet |
|
ViewFactory |
|
void |
|
void |
|
boolean |
|
void | |
void |
|
void |
|
void |
|
void |
|
void |
Methods inherited from class javax.swing.text.StyledEditorKit | |
clone , createDefaultDocument , createInputAttributes , deinstall , getActions , getCharacterAttributeRun , getInputAttributes , getViewFactory , install |
Methods inherited from class javax.swing.text.DefaultEditorKit | |
createCaret , createDefaultDocument , getActions , getContentType , getViewFactory , read , read , write , write |
Methods inherited from class javax.swing.text.EditorKit | |
clone , createCaret , createDefaultDocument , deinstall , getActions , getContentType , getViewFactory , install , read , read , write , write |
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public static final String BOLD_ACTION
The bold action identifier.
- Field Value:
- "html-bold-action"
public static final String COLOR_ACTION
The color action indentifier (passing the color as an argument).
- Field Value:
- "html-color-action"
public static final String DEFAULT_CSS
Default cascading stylesheed file ("default.css").
- Field Value:
- "default.css"
public static final String FONT_CHANGE_BIGGER
The increase font action identifier.
- Field Value:
- "html-font-bigger"
public static final String FONT_CHANGE_SMALLER
The decrease font action identifier.
- Field Value:
- "html-font-smaller"
public static final String IMG_ALIGN_BOTTOM
Align images at the bottom.
- Field Value:
- "html-image-align-bottom"
public static final String IMG_ALIGN_MIDDLE
Align images at the middle.
- Field Value:
- "html-image-align-middle"
public static final String IMG_ALIGN_TOP
Align images at the top.
- Field Value:
- "html-image-align-top"
public static final String IMG_BORDER
Align images at the border.
- Field Value:
- "html-image-border"
public static final String ITALIC_ACTION
The italic action identifier.
- Field Value:
- "html-italic-action"
public static final String LOGICAL_STYLE_ACTION
The "logical style" action identifier, passing that style as parameter.
- Field Value:
- "html-logical-style-action"
public static final String PARA_INDENT_LEFT
The "ident paragraph left" action.
- Field Value:
- "html-para-indent-left"
public static final String PARA_INDENT_RIGHT
The "ident paragraph right" action.
- Field Value:
- "html-para-indent-right"
public HTMLEditorKit()
Constructs an HTMLEditorKit, creates a StyleContext, and loads the style sheet.
public Object clone()
Creates a copy of the editor kit.
- Overrides:
- clone in interface StyledEditorKit
- Returns:
- a copy of this.
public Document createDefaultDocument()
Create a text storage model for this type of editor.
- Overrides:
- createDefaultDocument in interface StyledEditorKit
- Returns:
- the model
protected void createInputAttributes(Element element, MutableAttributeSet set)
Copies the key/values in elements AttributeSet into set. This does not copy component, icon, or element names attributes. This is called anytime the caret moves over a different location.
- Overrides:
- createInputAttributes in interface StyledEditorKit
- Parameters:
element
- - the element to create the input attributes for.set
- - the set to copy the values into.
public void deinstall(JEditorPane c)
Called when the this is removed from the JEditorPane. It unregisters any listeners.
- Overrides:
- deinstall in interface StyledEditorKit
- Parameters:
c
- - the JEditorPane being removed from.
public AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this.
- Specified by:
- getAccessibleContext in interface Accessible
- Returns:
- the AccessibleContext for this.
public Action[] getActions()
Gets the action list. This list is supported by the superclass augmented by the collection of actions defined locally for style operations.
- Overrides:
- getActions in interface StyledEditorKit
- Returns:
- an array of all the actions
public String getContentType()
Gets the content type that the kit supports. This kit supports the type text/html.
- Overrides:
- getContentType in interface DefaultEditorKit
public Cursor getDefaultCursor()
Returns the default cursor.
- Returns:
- the default cursor
public MutableAttributeSet getInputAttributes()
Gets the input attributes used for the styled editing actions.
- Overrides:
- getInputAttributes in interface StyledEditorKit
- Returns:
- the attribute set
public Cursor getLinkCursor()
Returns the cursor for links.
- Returns:
- the cursor for links.
protected HTMLEditorKit.Parser getParser()
Get the parser that this editor kit uses for reading HTML streams. This method can be overridden to use the alternative parser.
- Returns:
- the HTML parser (by default,
ParserDelegator
).
public StyleSheet getStyleSheet()
Get the set of styles currently being used to render the HTML elements. By default the resource specified by DEFAULT_CSS gets loaded, and is shared by all HTMLEditorKit instances.
- Returns:
- the style sheet.
public ViewFactory getViewFactory()
Gets a factory suitable for producing views of any models that are produced by this kit.
- Overrides:
- getViewFactory in interface StyledEditorKit
- Returns:
- the view factory suitable for producing views.
public void insertHTML(HTMLDocument doc, int offset, String html, int popDepth, int pushDepth, HTML.Tag insertTag) throws BadLocationException, IOException
Inserts HTML into an existing document.
- Parameters:
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 document
- Throws:
IOException
- - on any I/O errorBadLocationException
- - if pos represents an invalid location within the document
public void install(JEditorPane c)
Called when this is installed into the JEditorPane.
- Overrides:
- install in interface StyledEditorKit
- Parameters:
c
- - the JEditorPane installed into.
public boolean isAutoFormSubmission()
Returnstrue
when forms should be automatically submitted by the editor kit. Set this tofalse
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 istrue
.
- Returns:
true
when forms should be automatically submitted by the editor kit,false
otherwise
- Since:
- 1.5
public void read(Reader in, Document doc, int pos) throws IOException, BadLocationException
Inserts content from the given stream. Inserting HTML into a non-empty document must be inside the body Element, if you do not insert into the body an exception will be thrown. When inserting into a non-empty document all tags outside of the body (head, title) will be dropped.
- Overrides:
- read in interface DefaultEditorKit
- Parameters:
in
- - the stream to read fromdoc
- - the destination for the insertionpos
- - the location in the document to place the content
- Throws:
IOException
- - on any I/O errorBadLocationException
- - if pos represents an invalid location within the document
public void setAutoFormSubmission(boolean auto)
Sets whether or not the editor kit should automatically submit forms.
- Parameters:
auto
-true
when the editor kit should handle form submission,false
otherwise
- Since:
- 1.5
- See Also:
isAutoFormSubmission()
public void setDefaultCursor(Cursor cursor)
Sets the default cursor.
- Parameters:
cursor
- - the new default cursor.
public void setLinkCursor(Cursor cursor)
Sets the Cursor for links.
- Parameters:
cursor
- - the new cursor for links.
public void setStyleSheet(StyleSheet s)
Set the set of styles to be used to render the various HTML elements. These styles are specified in terms of CSS specifications. Each document produced by the kit will have a copy of the sheet which it can add the document specific styles to. By default, the StyleSheet specified is shared by all HTMLEditorKit instances.
- Parameters:
s
- - the new style sheet
public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException
Writes content from a document to the given stream in an appropriate format.
- Overrides:
- write in interface DefaultEditorKit
- Parameters:
out
- - the stream to write todoc
- - the source for the writepos
- - the location in the document to get the content.len
- - the amount to write out
- Throws:
IOException
- - on any I/O errorBadLocationException
- - if pos represents an invalid location within the document