Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Swing 1.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.swing
Class JEditorPane

    java.lang.Object
      |
      +--java.awt.Component
            |
            +--java.awt.Container
                  |
                  +--javax.swing.JComponent
                        |
                        +--javax.swing.text.JTextComponent
                              |
                              +--javax.swing.JEditorPane

Direct Known Subclasses:
  JTextPane

public class JEditorPane
extends JTextComponent

A text component to edit various kinds of content. This component uses implementations of the EditorKit to accomplish its behavior. It effectively morphs into the proper kind of text editor for the kind of content it is given. The content type that editor is bound to at any given time is determined by the EditorKit currently installed. If the content is set to a new URL, its type is used to determine the EditorKit that should be used to load the content.

By default, the following types of content are known:

text/plain
  Plain text, which is the default the type given isn't recognized. The kit used in this case is an extension of DefaultEditorKit that produces a wrapped plain text view.
text/html
  HTML text. The kit used in this case is the class `javax.swing.text.html.HTMLEditorKit` which provides html 3.2 support.
text/rtf
  RTF text. The kit used in this case is the class `javax.swing.text.rtf.RTFEditorKit` which provides a limited support of the Rich Text Format.

There are several ways to load content into this component.

1. The setText method can be used to initialize the component from a string. In this case the current EditorKit will be used, and the content type will be expected to be of this type.
2. The read method can be used to initialize the component from a Reader. Note that if the content type is html, relative references (e.g. for things like images) can't be resolved unless the <base> tag is used or the Base property on HTMLDocument is set. In this case the current EditorKit will be used, and the content type will be expected to be of this type.
3. The setPage method can be used to initialize the component from a URL. In this case, the content type will be determined from the URL, and the registered EditorKit for that content type will be set.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions, see the JEditorPane key assignments.

Some kinds of content may provide hyperlink support by generating hyperlink events. The html EditorKit will generate hyperlink events if the JEditorPane is not editable (i.e. `JEditorPane.setEditable(false);` has been called). If html frames are embedded in the document, the typical response would be to change a portion of the current document. The following code fragment is a possible hyperlink listener implementation, that treats html frame events specially, and simply displays any other activated hyperlinks. ``

    class Hyperactive implements HyperlinkListener {

    public void hyperlinkUpdate(HyperlinkEvent e) {
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
    JEditorPane pane = (JEditorPane) e.getSource();
    if (e instanceof HTMLFrameHyperlinkEvent) {
    HTMLFrameHyperlinkEvent  evt = (HTMLFrameHyperlinkEvent)e;
    HTMLDocument doc = (HTMLDocument)pane.getDocument();
    doc.processHTMLFrameHyperlinkEvent(evt);
    } else {
    try {
    pane.setPage(e.getURL());
    } catch (Throwable t) {
    t.printStackTrace();
    }
    }
    }
    }
    }

Culturally dependent information in some documents is handled through a mechanism called character encoding. Character encoding is an unambiguous mapping of the members of a character set (letters, ideographs, digits, symbols, or control functions) to specific numeric code values. It represents the way the file is stored. Example character encodings are ISO-8859-1, ISO-8859-5, Shift-jis, Euc-jp, and UTF-8. When the file is passed to an user agent (JEditorPane) it is converted to the document character set (ISO-10646 aka Unicode).

There are multiple ways to get a character set mapping to happen with JEditorPane.

1. One way is to specify the character set as a parameter of the MIME type. This will be established by a call to the setContentType method. If the content is loaded by the setPage method the content type will have been set according to the specification of the URL. It the file is loaded directly, the content type would be expected to have been set prior to loading.
2. Another way the character set can be specified is in the document itself. This requires reading the document prior to determining the character set that is desired. To handle this, it is expected that the EditorKit.read operation throw a ChangedCharSetException which will be caught. The read is then restarted with a new Reader that uses the character set specified in the ChangedCharSetException (which is an IOException).

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

See Also:
  Serialized Form

Inner Class Summary
`protected class` | `JEditorPane.AccessibleJEditorPane` The class used to obtain the accessible role for this object.
`protected class` | `JEditorPane.AccessibleJEditorPaneHTML` This class provides support for AccessibleHypertext, and is used in instances where the EditorKit installed in this JEditorPane is an instance of HTMLEditorKit.
`protected class` | `JEditorPane.JEditorPaneAccessibleHypertextSupport` What's returned by AccessibleJEditorPaneHTML.getAccessibleText() Provides support for AccessibleHypertext in case there is an HTML document being displayed in this JEditorPane.

Inner classes inherited from class javax.swing.text.JTextComponent
`JTextComponent.AccessibleJTextComponent, JTextComponent.KeyBinding`

Inner classes inherited from class javax.swing.JComponent
`JComponent.AccessibleJComponent`

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`

Constructor Summary
`JEditorPane()` Constructs a new JEditorPane.
`JEditorPane(java.lang.String url)` Creates a JEditorPane based on a string containing a URL specification.
`JEditorPane(java.lang.String type, java.lang.String text)` Creates a JEditorPane that has been initialized to the given text.
`JEditorPane(java.net.URL initialPage)` Creates a JEditorPane based on a specified URL for input.

Method Summary
`void` | `addHyperlinkListener(HyperlinkListener listener)` Adds a hyperlink listener for notification of any changes, for example when a link is selected and entered.
`protected EditorKit` | `createDefaultEditorKit()` Creates the default editor kit (PlainEditorKit) for when the component is first created.
`static EditorKit` | `createEditorKitForContentType(java.lang.String type)` Create a handler for the given type from the default registry of editor kits.
`void` | `fireHyperlinkUpdate(HyperlinkEvent e)` Notifies all listeners that have registered interest for notification on this event type.
`AccessibleContext` | `getAccessibleContext()` Get the AccessibleContext associated with this JEditorPane.
`java.lang.String` | `getContentType()` Gets the type of content that this editor is currently set to deal with.
`EditorKit` | `getEditorKit()` Fetches the currently installed kit for handling content.
`EditorKit` | `getEditorKitForContentType(java.lang.String type)` Fetches the editor kit to use for the given type of content.
`java.net.URL` | `getPage()` Gets the current url being displayed.
`java.awt.Dimension` | `getPreferredSize()` The preferred size for JEditorPane is slightly altered from the preferred size of the superclass.
`boolean` | `getScrollableTracksViewportHeight()` Returns true if a viewport should always force the height of this Scrollable to match the height of the viewport.
`boolean` | `getScrollableTracksViewportWidth()` Returns true if a viewport should always force the width of this Scrollable to match the width of the viewport.
`protected java.io.InputStream` | `getStream(java.net.URL page)` Fetch a stream for the given url, which is about to be loaded by the `setPage` method.
`java.lang.String` | `getText()` Returns the text contained in this TextComponent in terms of the content type of this editor.
`java.lang.String` | `getUIClassID()` Gets the class ID for the UI.
`boolean` | `isManagingFocus()` Turns off tab traversal once focus gained.
`protected java.lang.String` | `paramString()` Returns a string representation of this JEditorPane.
`protected void` | `processComponentKeyEvent(java.awt.event.KeyEvent e)` Make sure that TAB and Shift-TAB events get consumed, so that awt doesn't attempt focus traversal.
`void` | `read(java.io.InputStream in, java.lang.Object desc)` This method initializes from a stream.
`static void` | `registerEditorKitForContentType(java.lang.String type, java.lang.String classname)` Establishes the default bindings of type to name.
`static void` | `registerEditorKitForContentType(java.lang.String type, java.lang.String classname, java.lang.ClassLoader loader)` Establishes the default bindings of type to name.
`void` | `removeHyperlinkListener(HyperlinkListener listener)` Removes a hyperlink listener.
`void` | `replaceSelection(java.lang.String content)` Replaces the currently selected content with new content represented by the given string.
`protected void` | `scrollToReference(java.lang.String reference)` Scroll the view to the given reference location (i.e.
`void` | `setContentType(java.lang.String type)` Sets the type of content that this editor handles.
`void` | `setEditorKit(EditorKit kit)` Sets the currently installed kit for handling content.
`void` | `setEditorKitForContentType(java.lang.String type, EditorKit k)` Directly set the editor kit to use for the given type.
`void` | `setPage(java.lang.String url)` Sets the current url being displayed.
`void` | `setPage(java.net.URL page)` Sets the current url being displayed.
`void` | `setText(java.lang.String t)` Sets the text of this TextComponent to the specified content, which is expected to be in the format of the content type of this editor.

Methods inherited from class javax.swing.text.JTextComponent
`addCaretListener, addKeymap, copy, cut, fireCaretUpdate, getActions, getCaret, getCaretColor, getCaretPosition, getDisabledTextColor, getDocument, getFocusAccelerator, getHighlighter, getKeymap, getKeymap, getMargin, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getUI, isEditable, isFocusTraversable, isOpaque, loadKeymap, modelToView, moveCaretPosition, paste, read, removeCaretListener, removeKeymap, removeNotify, select, selectAll, setCaret, setCaretColor, setCaretPosition, setDisabledTextColor, setDocument, setEditable, setEnabled, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setOpaque, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write`

Methods inherited from class javax.swing.JComponent
`addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isLightweightComponent, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update`

Methods inherited from class java.awt.Container
`add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree`

Methods inherited from class java.awt.Component
`action, add, addComponentListener, addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, getBackground, getBounds, getColorModel, getCursor, getFont, getFontMetrics, getForeground, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isEnabled, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### JEditorPane

    public JEditorPane()

  Constructs a new JEditorPane. The document model is set to null.

### JEditorPane

    public JEditorPane(java.net.URL initialPage)
                throws java.io.IOException

  Creates a JEditorPane based on a specified URL for input.
  Parameters:
    `initialPage` - the URL
  Throws:
    java.io.IOException - if the URL is null or cannot be accessed

### JEditorPane

    public JEditorPane(java.lang.String url)
                throws java.io.IOException

  Creates a JEditorPane based on a string containing a URL specification.
  Parameters:
    `url` - the URL
  Throws:
    java.io.IOException - if the URL is null or cannot be accessed

### JEditorPane

    public JEditorPane(java.lang.String type,
                       java.lang.String text)

  Creates a JEditorPane that has been initialized to the given text. This is a convenience constructor that calls the `setContentType` and `setText` methods.
  Parameters:
    `type` - mime type of the given text.
    `text` - the text to initialize with.

Method Detail

### addHyperlinkListener

    public void addHyperlinkListener(HyperlinkListener listener)

  Adds a hyperlink listener for notification of any changes, for example when a link is selected and entered.
  Parameters:
    `listener` - the listener

### removeHyperlinkListener

    public void removeHyperlinkListener(HyperlinkListener listener)

  Removes a hyperlink listener.
  Parameters:
    `listener` - the listener

### fireHyperlinkUpdate

    public void fireHyperlinkUpdate(HyperlinkEvent e)

  Notifies all listeners that have registered interest for notification on this event type. This is normally called by the currently installed EditorKit if a content type that supports hyperlinks is currently active and there was activity with a link. The listener list is processed last to first.
  Parameters:
    `e` - the event
  See Also:
    `EventListenerList`

### setPage

    public void setPage(java.net.URL page)
                 throws java.io.IOException

  Sets the current url being displayed. The content type of the pane is set, and if the editor kit for the pane is non-null, then a new default document is created and the URL is read into it. If the url contains and reference location, the location will be scrolled to by calling the `scrollToReference` method. If the desired URL is not the one currently being displayed, the `getStream` method is called to give subclasses control over the stream provided.

  This may load either synchronously or asynchronously depending upon the document returned by the EditorKit. If the Document is of type AbstractDocument and has a value returned by `AbstractDocument.getAsynchronousLoadPriority` that is greater than or equal to zero, the page will be loaded on a seperate thread using that priority.

  If the document is loaded synchronously, it will be filled in with the stream prior to being installed into the editor with a call to `setDocument`, which is bound and will fire a property change event. If an IOException is thrown the partially loaded document will be discarded and neither the document or page property change events will be fired. If the document is successfully loaded and installed, a view will be built for it by the UI which will then be scrolled if necessary, and then the page property change event will be fired.

  If the document is loaded asynchronously, the document will be installed into the editor immediately using a call to `setDocument` which will fire a document property change event, then a thread will be created which will begin doing the actual loading. In this case, the page property change event will not be fired by the call to this method directly, but rather will be fired when the thread doing the loading has finished. Since the calling thread can not throw an IOException in the event of failure on the other thread, the page property change event will be fired when the other thread is done whether the load was successful or not.

  Parameters:
    `page` - the URL of the page
  Throws:
    java.io.IOException - for a null or invalid page specification, or exception from the stream being read.
  See Also:
    `getPage()`

### read

    public void read(java.io.InputStream in,
                     java.lang.Object desc)
              throws java.io.IOException

  This method initializes from a stream. If the kit is set to be of type HTMLEditorKit, and the desc parameter is an HTMLDocument, then it invokes the HTMLEditorKit to initiate the read. Otherwise it calls the superclass method which loads the model as plain text.
  Parameters:
    `in` - The stream to read from
    `desc` - An object describing the stream.
  Throws:
    java.io.IOException - as thrown by the stream being used to initialize.
  See Also:
    `JTextComponent.read(java.io.Reader, java.lang.Object)`, `JTextComponent.setDocument(javax.swing.text.Document)`

### getStream

    protected java.io.InputStream getStream(java.net.URL page)
                                     throws java.io.IOException

  Fetch a stream for the given url, which is about to be loaded by the `setPage` method. By default, this simply opens the url and returns the stream. This can be reimplemented to do useful things like fetch the stream from a cache, monitor the progress of the stream, etc.

  This method is expected to have the the side effect of establising the content type, and therefore setting the appropriate EditorKit to use for loading the stream.

### scrollToReference

    protected void scrollToReference(java.lang.String reference)

  Scroll the view to the given reference location (i.e. the value returned by the `UL.getRef` method for the url being displayed). By default, this method only knows how to locate a reference in an HTMLDocument. The implementation calls the `scrollRectToVisible` method to accomplish the actual scrolling. If scrolling to a reference location is needed for document types other than html, this method should be reimplemented. This method will have no effect if the component is not visible.
  Parameters:
    `reference` - the named location to scroll to.

### getPage

    public java.net.URL getPage()

  Gets the current url being displayed. If a URL was not specified in the creation of the document, this will return null, and relative URL's will not be resolved.
  Returns:
    the URL

### setPage

    public void setPage(java.lang.String url)
                 throws java.io.IOException

  Sets the current url being displayed.
  Parameters:
    `url` - the URL for display
  Throws:
    java.io.IOException - for a null or invalid URL specification

### getUIClassID

    public java.lang.String getUIClassID()

  Gets the class ID for the UI.
  Returns:
    the ID ("EditorPaneUI")
  Overrides:
    getUIClassID in class JComponent
  See Also:
    `JComponent.getUIClassID()`, `UIDefaults.getUI(javax.swing.JComponent)`

### createDefaultEditorKit

    protected EditorKit createDefaultEditorKit()

  Creates the default editor kit (PlainEditorKit) for when the component is first created.
  Returns:
    the editor kit

### getEditorKit

    public final EditorKit getEditorKit()

  Fetches the currently installed kit for handling content. createDefaultEditorKit() is called to set up a default if necessary.
  Returns:
    the editor kit

### getContentType

    public final java.lang.String getContentType()

  Gets the type of content that this editor is currently set to deal with. This is defined to be the type associated with the currently installed EditorKit.
  Returns:
    the content type, null if no editor kit set

### setContentType

    public final void setContentType(java.lang.String type)

  Sets the type of content that this editor handles. This calls `getEditorKitForContentType`, and then `setEditorKit` if an editor kit can be successfully located. This is mostly convenience method that can be used as an alternative to calling `setEditorKit` directly.

  If there is a charset definition specified as a parameter of the content type specification, it will be used when loading input streams using the associated EditorKit. For example if the type is specified as `text/html; charset=EUC-JP` the content will be loaded using the EditorKit registered for `text/html` and the Reader provided to the EditorKit to load unicode into the document will use the `EUC-JP` charset for translating to unicode.

  Parameters:
    `type` - the non-null mime type for the content editing support.
  See Also:
    `getContentType()`

### setEditorKit

    public void setEditorKit(EditorKit kit)

  Sets the currently installed kit for handling content. This is the bound property that establishes the content type of the editor. Any old kit is first deinstalled, then if kit is non-null, the new kit is installed, and a default document created for it. A PropertyChange event ("editorKit") is always fired when setEditorKit() is called.
  Parameters:
    `kit` - the desired editor behavior.
  See Also:
    `getEditorKit()`

### getEditorKitForContentType

    public EditorKit getEditorKitForContentType(java.lang.String type)

  Fetches the editor kit to use for the given type of content. This is called when a type is requested that doesn't match the currently installed type. If the component doesn't have an EditorKit registered for the given type, it will try to create an EditorKit from the default EditorKit registry. If that fails, a PlainEditorKit is used on the assumption that all text documents can be represented as plain text.

  This method can be reimplemented to use some other kind of type registry. This can be reimplemented to use the Java Activation Framework for example.

  Parameters:
    `type` - the non-null content type
  Returns:
    the editor kit

### setEditorKitForContentType

    public void setEditorKitForContentType(java.lang.String type,
                                           EditorKit k)

  Directly set the editor kit to use for the given type. A look-and-feel implementation might use this in conjunction with createEditorKitForContentType to install handlers for content types with a look-and-feel bias.
  Parameters:
    `type` - the non-null content type
    `k` - the editor kit to be set

### replaceSelection

    public void replaceSelection(java.lang.String content)

  Replaces the currently selected content with new content represented by the given string. If there is no selection this amounts to an insert of the given text. If there is no replacement text this amounts to a removal of the current selection. The replacement text will have the attributes currently defined for input. If the document is not editable, beep and return. Then if the document is null, do nothing. If the content to insert is null or empty, ignore it.

  This method is thread safe, although most Swing methods are not. Please see Threads and Swing for more information.

  Parameters:
    `content` - the content to replace the selection with
  Overrides:
    replaceSelection in class JTextComponent

### createEditorKitForContentType

    public static EditorKit createEditorKitForContentType(java.lang.String type)

  Create a handler for the given type from the default registry of editor kits. The registry is created if necessary. It the registered class has not yet been loaded, an attempt is made to dynamically load the prototype of the kit for the given type. If the type was registered with a ClassLoader, that ClassLoader will be used to load the prototype. If there was no registered ClassLoader, Class.forName will be used to load the prototype.

  Once a prototype EditorKit instance is successfully located, it is cloned and the clone is returned.

  Parameters:
    `type` - the content type
  Returns:
    the editor kit, or null if one cannot be created

### registerEditorKitForContentType

    public static void registerEditorKitForContentType(java.lang.String type,
                                                       java.lang.String classname)

  Establishes the default bindings of type to name. The class will be dynamically loaded later when actually needed, and can be safely changed before attempted uses to avoid loading unwanted classes. The prototype EditorKit will be loaded with Class.forName when registered with this method.
  Parameters:
    `type` - the non-null content type
    `classname` - the class to load later

### registerEditorKitForContentType

    public static void registerEditorKitForContentType(java.lang.String type,
                                                       java.lang.String classname,
                                                       java.lang.ClassLoader loader)

  Establishes the default bindings of type to name. The class will be dynamically loaded later when actually needed using the given ClassLoader, and can be safely changed before attempted uses to avoid loading unwanted classes.
  Parameters:
    `type` - the non-null content type
    `classname` - the class to load later
    `loader` - the ClassLoader to use to load the name

### getPreferredSize

    public java.awt.Dimension getPreferredSize()

  The preferred size for JEditorPane is slightly altered from the preferred size of the superclass. If the size of the viewport has become smaller than the minimum size of the component, the Scrollable definition for tracking width or height will turn to false. The default viewport layout will give the preferred size, and that is not desired in the case where the scrollable is tracking. In that case the normal preferred size is adjusted to the minimum size. This allows things like html tables to shrink down to their minimum size and then be laid out at their minimum size, refusing to shrink any further.
  Overrides:
    getPreferredSize in class JComponent

### isManagingFocus

    public boolean isManagingFocus()

  Turns off tab traversal once focus gained.
  Returns:
    true, to indicate that the focus is being managed
  Overrides:
    isManagingFocus in class JComponent

### processComponentKeyEvent

    protected void processComponentKeyEvent(java.awt.event.KeyEvent e)

  Make sure that TAB and Shift-TAB events get consumed, so that awt doesn't attempt focus traversal.
  Overrides:
    processComponentKeyEvent in class JTextComponent

### setText

    public void setText(java.lang.String t)

  Sets the text of this TextComponent to the specified content, which is expected to be in the format of the content type of this editor. For example, if the type is set to `text/html` the string should be specified in terms of html. This is implemented to call `JTextComponent.read` with a `StringReader`[

  This method is thread safe, although most Swing methods are not. Please see Threads and Swing for more information.

  Parameters:
    `t` - the new text to be set
  Overrides:
    setText in class JTextComponent
  See Also:
    `getText()`

### getText

    public java.lang.String getText()

  Returns the text contained in this TextComponent in terms of the content type of this editor. If an exception is thrown while attempting to retrieve the text, null will be returned. This is implemented to call `JTextComponent.write` with a `StringWriter`.
  Returns:
    the text
  Overrides:
    getText in class JTextComponent
  See Also:
    `setText(java.lang.String)`

### getScrollableTracksViewportWidth

    public boolean getScrollableTracksViewportWidth()

  Returns true if a viewport should always force the width of this Scrollable to match the width of the viewport.
  Returns:
    true if a viewport should force the Scrollables width to match its own.
  Overrides:
    getScrollableTracksViewportWidth in class JTextComponent

### getScrollableTracksViewportHeight

    public boolean getScrollableTracksViewportHeight()

  Returns true if a viewport should always force the height of this Scrollable to match the height of the viewport.
  Returns:
    true if a viewport should force the Scrollables height to match its own.
  Overrides:
    getScrollableTracksViewportHeight in class JTextComponent

### paramString

    protected java.lang.String paramString()

  Returns a string representation of this JEditorPane. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be `null`.

  Overriding paramString() to provide information about the specific new aspects of the JFC components.

  Returns:
    a string representation of this JEditorPane.
  Overrides:
    paramString in class JTextComponent

### getAccessibleContext

    public AccessibleContext getAccessibleContext()

  Get the AccessibleContext associated with this JEditorPane. A new context is created if necessary.
  Returns:
    the AccessibleContext of this JEditorPane
  Overrides:
    getAccessibleContext in class JTextComponent

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Swing 1.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.