|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.text.JTextComponent
javax.swing.JEditorPane
org.jdesktop.swingx.JXEditorPane
public class JXEditorPane
JXEditorPane
offers enhanced functionality over the standard JEditorPane
.
JXEditorPane
provides HTML editing commands that alter functionality
depending on the document state. Currently, the user can quick-format the
document with headers (H# tags), paragraphs, and breaks.UndoableEditEvent
s. JXEditorPane
places those events in an UndoManager
and provides
undo/redo commands. Undo and redo are context-sensitive (like
the text commands) and will only be active if it is possible to perform the
command.JXEditorPane
provides search capabilities, allowing the user to find text
within the document.
Creating a JXEditorPane
is no different than creating a JEditorPane
. However, the following example demonstrates the best way to
access the improved command functionality.
JXEditorPane editorPane = new JXEditorPane("some URL"); add(editorPane); JToolBar toolBar = ActionContainerFactory.createToolBar(editorPane.getCommands[]); toolBar.addSeparator(); toolBar.add(editorPane.getParagraphSelector()); setToolBar(toolBar);
Nested Class Summary | |
---|---|
class |
JXEditorPane.DocumentSearchable
A Searchable implementation for Document s. |
Nested classes/interfaces inherited from class javax.swing.JEditorPane |
---|
JEditorPane.AccessibleJEditorPane, JEditorPane.AccessibleJEditorPaneHTML, JEditorPane.JEditorPaneAccessibleHypertextSupport |
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent |
---|
JTextComponent.AccessibleJTextComponent, JTextComponent.KeyBinding |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class javax.swing.JEditorPane |
---|
HONOR_DISPLAY_PROPERTIES, W3C_LENGTH_UNITS |
Fields inherited from class javax.swing.text.JTextComponent |
---|
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
JXEditorPane()
Creates a new JXEditorPane . |
|
JXEditorPane(String url)
Creates a JXEditorPane based on a string containing
a URL specification. |
|
JXEditorPane(String type,
String text)
Creates a JXEditorPane that has been initialized
to the given text. |
|
JXEditorPane(URL initialPage)
Creates a JXEditorPane based on a specified URL for input. |
Method Summary | |
---|---|
protected void |
applyTag(HTML.Tag tag)
Applys the tag to the current selection |
boolean |
doCommand(Object command,
Object value)
Perform the command using the object value. |
Object[] |
getCommands()
Returns an array of supported commands. |
JComboBox |
getParagraphSelector()
Retrieves a component which will be used as the paragraph selector. |
Searchable |
getSearchable()
|
boolean |
hasCommand(Object command)
Return a flag that indicates if a command is supported. |
protected void |
initActions()
Register the actions that this class can handle. |
void |
paste()
The paste method has been overloaded to strip off the tags This doesn't really work. |
void |
setEditorKit(EditorKit kit)
Overidden to perform document initialization based on type. |
void |
setSearchable(Searchable searchable)
sets the Searchable for this editor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JXEditorPane()
JXEditorPane
.
The document model is set to null
.
public JXEditorPane(String url) throws IOException
JXEditorPane
based on a string containing
a URL specification.
url
- the URL
IOException
- if the URL is null
or
cannot be accessedpublic JXEditorPane(String type, String text)
JXEditorPane
that has been initialized
to the given text. This is a convenience constructor that calls the
setContentType
and setText
methods.
type
- mime type of the given texttext
- the text to initialize with; may be null
NullPointerException
- if the type
parameter
is null
public JXEditorPane(URL initialPage) throws IOException
JXEditorPane
based on a specified URL for input.
initialPage
- the URL
IOException
- if the URL is null
or cannot be accessedMethod Detail |
---|
public void setEditorKit(EditorKit kit)
setEditorKit
in class JEditorPane
kit
- the desired editor behaviorJEditorPane.getEditorKit()
protected void initActions()
public JComboBox getParagraphSelector()
Note: This is only valid for the HTMLEditorKit
protected void applyTag(HTML.Tag tag)
public void paste()
paste
in class JTextComponent
JTextComponent.replaceSelection(java.lang.String)
,
Toolkit.getSystemClipboard()
,
Clipboard
public Searchable getSearchable()
public void setSearchable(Searchable searchable)
searchable
- public boolean hasCommand(Object command)
Targetable
hasCommand
in interface Targetable
command
- is a Action.ACTION_COMMAND_KEY
public Object[] getCommands()
Targetable
getCommands
in interface Targetable
public boolean doCommand(Object command, Object value)
Targetable
doCommand
in interface Targetable
command
- is a Action.ACTION_COMMAND_KEYvalue
- an arbitrary value. Usually this will be
EventObject which trigered the command.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |