< prev index next >
src/java.desktop/share/classes/javax/swing/JEditorPane.java
Print this page
@@ -47,60 +47,60 @@
* <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/text.html">Using Text Components</a>,
* a section in <em>The Java Tutorial.</em>
*
* <p>
* This component uses implementations of the
- * <code>EditorKit</code> to accomplish its behavior. It effectively
+ * {@code 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 <code>EditorKit</code> currently
+ * to at any given time is determined by the {@code EditorKit} currently
* installed. If the content is set to a new URL, its type is used
- * to determine the <code>EditorKit</code> that should be used to
+ * to determine the {@code EditorKit} that should be used to
* load the content.
* <p>
* By default, the following types of content are known:
* <dl>
* <dt><b>text/plain</b>
* <dd>Plain text, which is the default the type given isn't
* recognized. The kit used in this case is an extension of
- * <code>DefaultEditorKit</code> that produces a wrapped plain text view.
+ * {@code DefaultEditorKit} that produces a wrapped plain text view.
* <dt><b>text/html</b>
* <dd>HTML text. The kit used in this case is the class
- * <code>javax.swing.text.html.HTMLEditorKit</code>
+ * {@code javax.swing.text.html.HTMLEditorKit}
* which provides HTML 3.2 support.
* <dt><b>text/rtf</b>
* <dd>RTF text. The kit used in this case is the class
- * <code>javax.swing.text.rtf.RTFEditorKit</code>
+ * {@code javax.swing.text.rtf.RTFEditorKit}
* which provides a limited support of the Rich Text Format.
* </dl>
* <p>
* There are several ways to load content into this component.
* <ol>
* <li>
* The {@link #setText setText} method can be used to initialize
* the component from a string. In this case the current
- * <code>EditorKit</code> will be used, and the content type will be
+ * {@code EditorKit} will be used, and the content type will be
* expected to be of this type.
* <li>
* The {@link #read read} method can be used to initialize the
- * component from a <code>Reader</code>. Note that if the content type is HTML,
+ * component from a {@code 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 <em>Base</em> property
- * on <code>HTMLDocument</code> is set.
- * In this case the current <code>EditorKit</code> will be used,
+ * on {@code HTMLDocument} is set.
+ * In this case the current {@code EditorKit} will be used,
* and the content type will be expected to be of this type.
* <li>
* The {@link #setPage 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 <code>EditorKit</code>
+ * determined from the URL, and the registered {@code EditorKit}
* for that content type will be set.
* </ol>
* <p>
* Some kinds of content may provide hyperlink support by generating
- * hyperlink events. The HTML <code>EditorKit</code> will generate
- * hyperlink events if the <code>JEditorPane</code> is <em>not editable</em>
- * (<code>JEditorPane.setEditable(false);</code> has been called).
+ * hyperlink events. The HTML {@code EditorKit} will generate
+ * hyperlink events if the {@code JEditorPane} is <em>not editable</em>
+ * ({@code 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.
@@ -135,15 +135,15 @@
* 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 (<code>JEditorPane</code>) it is converted to
+ * passed to an user agent ({@code JEditorPane}) it is converted to
* the document character set (ISO-10646 aka Unicode).
* <p>
* There are multiple ways to get a character set mapping to happen
- * with <code>JEditorPane</code>.
+ * with {@code JEditorPane}.
* <ol>
* <li>
* One way is to specify the character set as a parameter of the MIME
* type. This will be established by a call to the
* {@link #setContentType setContentType} method. If the content
@@ -153,15 +153,15 @@
* have been set prior to loading.
* <li>
* 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
- * <code>EditorKit</code>.read operation throw a
- * <code>ChangedCharSetException</code> which will
+ * {@code EditorKit}.read operation throw a
+ * {@code ChangedCharSetException} which will
* be caught. The read is then restarted with a new Reader that uses
- * the character set specified in the <code>ChangedCharSetException</code>
- * (which is an <code>IOException</code>).
+ * the character set specified in the {@code ChangedCharSetException}
+ * (which is an {@code IOException}).
* </ol>
*
* <dl>
* <dt><b>Newlines</b>
* <dd>
@@ -179,11 +179,11 @@
* 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. As of 1.4, support for long term storage
* of all JavaBeans™
- * has been added to the <code>java.beans</code> package.
+ * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @beaninfo
* attribute: isContainer false
* description: A text component to edit various types of content.
@@ -193,12 +193,12 @@
*/
@SuppressWarnings("serial") // Same-version serialization only
public class JEditorPane extends JTextComponent {
/**
- * Creates a new <code>JEditorPane</code>.
- * The document model is set to <code>null</code>.
+ * Creates a new {@code JEditorPane}.
+ * The document model is set to {@code null}.
*/
public JEditorPane() {
super();
setFocusCycleRoot(true);
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy() {
@@ -254,43 +254,43 @@
JComponent.
getManagingFocusBackwardTraversalKeys());
}
/**
- * Creates a <code>JEditorPane</code> based on a specified URL for input.
+ * Creates a {@code JEditorPane} based on a specified URL for input.
*
* @param initialPage the URL
- * @exception IOException if the URL is <code>null</code>
+ * @exception IOException if the URL is {@code null}
* or cannot be accessed
*/
public JEditorPane(URL initialPage) throws IOException {
this();
setPage(initialPage);
}
/**
- * Creates a <code>JEditorPane</code> based on a string containing
+ * Creates a {@code JEditorPane} based on a string containing
* a URL specification.
*
* @param url the URL
- * @exception IOException if the URL is <code>null</code> or
+ * @exception IOException if the URL is {@code null} or
* cannot be accessed
*/
public JEditorPane(String url) throws IOException {
this();
setPage(url);
}
/**
- * Creates a <code>JEditorPane</code> that has been initialized
+ * Creates a {@code JEditorPane} that has been initialized
* to the given text. This is a convenience constructor that calls the
- * <code>setContentType</code> and <code>setText</code> methods.
+ * {@code setContentType} and {@code setText} methods.
*
* @param type mime type of the given text
- * @param text the text to initialize with; may be <code>null</code>
- * @exception NullPointerException if the <code>type</code> parameter
- * is <code>null</code>
+ * @param text the text to initialize with; may be {@code null}
+ * @exception NullPointerException if the {@code type} parameter
+ * is {@code null}
*/
public JEditorPane(String type, String text) {
this();
setContentType(type);
setText(text);
@@ -314,25 +314,25 @@
public synchronized void removeHyperlinkListener(HyperlinkListener listener) {
listenerList.remove(HyperlinkListener.class, listener);
}
/**
- * Returns an array of all the <code>HyperLinkListener</code>s added
+ * Returns an array of all the {@code HyperLinkListener}s added
* to this JEditorPane with addHyperlinkListener().
*
- * @return all of the <code>HyperLinkListener</code>s added or an empty
+ * @return all of the {@code HyperLinkListener}s added or an empty
* array if no listeners have been added
* @since 1.4
*/
public synchronized HyperlinkListener[] getHyperlinkListeners() {
return listenerList.getListeners(javax.swing.event.HyperlinkListener.class);
}
/**
* Notifies all listeners that have registered interest for
* notification on this event type. This is normally called
- * by the currently installed <code>EditorKit</code> if a content type
+ * by the currently installed {@code 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.
*
* @param e the event
@@ -352,14 +352,14 @@
/**
* Sets the current URL being displayed. The content type of the
* pane is set, and if the editor kit for the pane is
- * non-<code>null</code>, then
+ * non-{@code 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 <code>scrollToReference</code>
+ * be scrolled to by calling the {@code scrollToReference}
* method. If the desired URL is the one currently being displayed,
* the document will not be reloaded. To force a document
* reload it is necessary to clear the stream description property
* of the document. The following code shows how this can be done:
*
@@ -367,50 +367,50 @@
* Document doc = jEditorPane.getDocument();
* doc.putProperty(Document.StreamDescriptionProperty, null);
* </pre>
*
* If the desired URL is not the one currently being
- * displayed, the <code>getStream</code> method is called to
+ * displayed, the {@code getStream} method is called to
* give subclasses control over the stream provided.
* <p>
* This may load either synchronously or asynchronously
- * depending upon the document returned by the <code>EditorKit</code>.
- * If the <code>Document</code> is of type
- * <code>AbstractDocument</code> and has a value returned by
- * <code>AbstractDocument.getAsynchronousLoadPriority</code>
+ * depending upon the document returned by the {@code EditorKit}.
+ * If the {@code Document} is of type
+ * {@code AbstractDocument} and has a value returned by
+ * {@code AbstractDocument.getAsynchronousLoadPriority}
* that is greater than or equal to zero, the page will be
* loaded on a separate thread using that priority.
* <p>
* 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 <code>setDocument</code>, which
+ * the editor with a call to {@code setDocument}, which
* is bound and will fire a property change event. If an
- * <code>IOException</code> is thrown the partially loaded
+ * {@code 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.
* <p>
* If the document is loaded asynchronously, the document
* will be installed into the editor immediately using a
- * call to <code>setDocument</code> which will fire a
+ * call to {@code 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.
* It will also be fired on the event-dispatch thread.
- * Since the calling thread can not throw an <code>IOException</code>
+ * Since the calling thread can not throw an {@code 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.
*
* @param page the URL of the page
- * @exception IOException for a <code>null</code> or invalid
+ * @exception IOException for a {@code null} or invalid
* page specification, or exception from the stream being read
* @see #getPage
* @beaninfo
* description: the URL used to set content
* bound: true
@@ -516,13 +516,13 @@
((AbstractDocument) doc).getAsynchronousLoadPriority() : -1);
}
/**
* This method initializes from a stream. If the kit is
- * set to be of type <code>HTMLEditorKit</code>, and the
- * <code>desc</code> parameter is an <code>HTMLDocument</code>,
- * then it invokes the <code>HTMLEditorKit</code> to initiate
+ * set to be of type {@code HTMLEditorKit}, and the
+ * {@code desc} parameter is an {@code HTMLDocument},
+ * then it invokes the {@code HTMLEditorKit} to initiate
* the read. Otherwise it calls the superclass
* method which loads the model as plain text.
*
* @param in the stream from which to read
* @param desc an object describing the stream
@@ -546,14 +546,14 @@
}
}
/**
- * This method invokes the <code>EditorKit</code> to initiate a
- * read. In the case where a <code>ChangedCharSetException</code>
+ * This method invokes the {@code EditorKit} to initiate a
+ * read. In the case where a {@code ChangedCharSetException}
* is thrown this exception will contain the new CharSet.
- * Therefore the <code>read</code> operation
+ * Therefore the {@code read} operation
* is then restarted after building a new Reader with the new charset.
*
* @param in the inputstream to use
* @param doc the document to load
*
@@ -708,23 +708,23 @@
Document doc;
}
/**
* Fetches a stream for the given URL, which is about to
- * be loaded by the <code>setPage</code> method. By
+ * be loaded by the {@code 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.
* <p>
* This method is expected to have the side effect of
* establishing the content type, and therefore setting the
- * appropriate <code>EditorKit</code> to use for loading the stream.
+ * appropriate {@code EditorKit} to use for loading the stream.
* <p>
* If this the stream was an http connection, redirects
* will be followed and the resulting URL will be set as
- * the <code>Document.StreamDescriptionProperty</code> so that relative
+ * the {@code Document.StreamDescriptionProperty} so that relative
* URL's can be properly resolved.
*
* @param page the URL of the page
* @return a stream for the URL which is about to be loaded
* @throws IOException if an I/O problem occurs
@@ -816,15 +816,15 @@
}
/**
* Scrolls the view to the given reference location
- * (that is, the value returned by the <code>UL.getRef</code>
+ * (that is, the value returned by the {@code 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
- * <code>scrollRectToVisible</code> method to
+ * {@code 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.
@@ -862,24 +862,24 @@
}
/**
* Gets the current URL being displayed. If a URL was
* not specified in the creation of the document, this
- * will return <code>null</code>, and relative URL's will not be
+ * will return {@code null}, and relative URL's will not be
* resolved.
*
- * @return the URL, or <code>null</code> if none
+ * @return the URL, or {@code null} if none
*/
public URL getPage() {
return (URL) getDocument().getProperty(Document.StreamDescriptionProperty);
}
/**
* Sets the current URL being displayed.
*
* @param url the URL for display
- * @exception IOException for a <code>null</code> or invalid URL
+ * @exception IOException for a {@code null} or invalid URL
* specification
*/
public void setPage(String url) throws IOException {
if (url == null) {
throw new IOException("invalid url");
@@ -898,22 +898,22 @@
public String getUIClassID() {
return uiClassID;
}
/**
- * Creates the default editor kit (<code>PlainEditorKit</code>) for when
+ * Creates the default editor kit ({@code PlainEditorKit}) for when
* the component is first created.
*
* @return the editor kit
*/
protected EditorKit createDefaultEditorKit() {
return new PlainEditorKit();
}
/**
* Fetches the currently installed kit for handling content.
- * <code>createDefaultEditorKit</code> is called to set up a default
+ * {@code createDefaultEditorKit} is called to set up a default
* if necessary.
*
* @return the editor kit
*/
public EditorKit getEditorKit() {
@@ -926,46 +926,46 @@
/**
* 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 <code>EditorKit</code>.
+ * currently installed {@code EditorKit}.
*
- * @return the content type, <code>null</code> if no editor kit set
+ * @return the content type, {@code null} if no editor kit set
*/
public final String getContentType() {
return (kit != null) ? kit.getContentType() : null;
}
/**
* Sets the type of content that this editor
- * handles. This calls <code>getEditorKitForContentType</code>,
- * and then <code>setEditorKit</code> if an editor kit can
+ * handles. This calls {@code getEditorKitForContentType},
+ * and then {@code setEditorKit} if an editor kit can
* be successfully located. This is mostly convenience method
* that can be used as an alternative to calling
- * <code>setEditorKit</code> directly.
+ * {@code setEditorKit} directly.
* <p>
* 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 <code>EditorKit</code>.
+ * loading input streams using the associated {@code EditorKit}.
* For example if the type is specified as
- * <code>text/html; charset=EUC-JP</code> the content
- * will be loaded using the <code>EditorKit</code> registered for
- * <code>text/html</code> and the Reader provided to
- * the <code>EditorKit</code> to load unicode into the document will
- * use the <code>EUC-JP</code> charset for translating
+ * {@code text/html; charset=EUC-JP} the content
+ * will be loaded using the {@code EditorKit} registered for
+ * {@code text/html} and the Reader provided to
+ * the {@code EditorKit} to load unicode into the document will
+ * use the {@code EUC-JP} charset for translating
* to unicode. If the type is not recognized, the content
- * will be loaded using the <code>EditorKit</code> registered
- * for plain text, <code>text/plain</code>.
+ * will be loaded using the {@code EditorKit} registered
+ * for plain text, {@code text/plain}.
*
- * @param type the non-<code>null</code> mime type for the content editing
+ * @param type the non-{@code null} mime type for the content editing
* support
* @see #getContentType
* @beaninfo
* description: the type of content
- * @throws NullPointerException if the <code>type</code> parameter
- * is <code>null</code>
+ * @throws NullPointerException if the {@code type} parameter
+ * is {@code null}
*/
public final void setContentType(String type) {
// The type could have optional info is part of it,
// for example some charset info. We need to strip that
// of and save it.
@@ -1030,19 +1030,19 @@
/**
* 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-<code>null</code>,
+ * non-{@code null},
* the new kit is installed, and a default document created for it.
- * A <code>PropertyChange</code> event ("editorKit") is always fired when
- * <code>setEditorKit</code> is called.
+ * A {@code PropertyChange} event ("editorKit") is always fired when
+ * {@code setEditorKit} is called.
* <p>
* <em>NOTE: This has the side effect of changing the model,
- * because the <code>EditorKit</code> is the source of how a
+ * because the {@code EditorKit} is the source of how a
* particular type
- * of content is modeled. This method will cause <code>setDocument</code>
+ * of content is modeled. This method will cause {@code setDocument}
* to be called on behalf of the caller to ensure integrity
* of the internal state.</em>
*
* @param kit the desired editor behavior
* @see #getEditorKit
@@ -1067,23 +1067,23 @@
/**
* 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 <code>EditorKit</code> registered
+ * If the component doesn't have an {@code EditorKit} registered
* for the given type, it will try to create an
- * <code>EditorKit</code> from the default <code>EditorKit</code> registry.
- * If that fails, a <code>PlainEditorKit</code> is used on the
+ * {@code EditorKit} from the default {@code EditorKit} registry.
+ * If that fails, a {@code PlainEditorKit} is used on the
* assumption that all text documents can be represented
* as plain text.
* <p>
* 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.
*
- * @param type the non-<code>null</code> content type
+ * @param type the non-{@code null} content type
* @return the editor kit
*/
public EditorKit getEditorKitForContentType(String type) {
if (typeHandlers == null) {
typeHandlers = new Hashtable<String, EditorKit>(3);
@@ -1102,14 +1102,14 @@
}
/**
* Directly sets the editor kit to use for the given type. A
* look-and-feel implementation might use this in conjunction
- * with <code>createEditorKitForContentType</code> to install handlers for
+ * with {@code createEditorKitForContentType} to install handlers for
* content types with a look-and-feel bias.
*
- * @param type the non-<code>null</code> content type
+ * @param type the non-{@code null} content type
* @param k the editor kit to be set
*/
public void setEditorKitForContentType(String type, EditorKit k) {
if (typeHandlers == null) {
typeHandlers = new Hashtable<String, EditorKit>(3);
@@ -1120,17 +1120,17 @@
/**
* 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 (i.e. the content string is empty
- * or <code>null</code>) this amounts to a removal of the
+ * or {@code null}) this amounts to a removal of the
* current selection. The replacement text will have the
* attributes currently defined for input. If the component is not
* editable, beep and return.
*
* @param content the content to replace the selection with. This
- * value can be <code>null</code>
+ * value can be {@code null}
*/
@Override
public void replaceSelection(String content) {
if (! isEditable()) {
UIManager.getLookAndFeel().provideErrorFeedback(JEditorPane.this);
@@ -1172,20 +1172,20 @@
/**
* Creates a handler for the given type from the default registry
* of editor kits. The registry is created if necessary. If 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 <code>ClassLoader</code>,
- * that <code>ClassLoader</code> will be used to load the prototype.
- * If there was no registered <code>ClassLoader</code>,
- * <code>Class.forName</code> will be used to load the prototype.
+ * given type. If the type was registered with a {@code ClassLoader},
+ * that {@code ClassLoader} will be used to load the prototype.
+ * If there was no registered {@code ClassLoader},
+ * {@code Class.forName} will be used to load the prototype.
* <p>
- * Once a prototype <code>EditorKit</code> instance is successfully
+ * Once a prototype {@code EditorKit} instance is successfully
* located, it is cloned and the clone is returned.
*
* @param type the content type
- * @return the editor kit, or <code>null</code> if there is nothing
+ * @return the editor kit, or {@code null} if there is nothing
* registered for the given type
*/
public static EditorKit createEditorKitForContentType(String type) {
Hashtable<String, EditorKit> kitRegistry = getKitRegisty();
EditorKit k = kitRegistry.get(type);
@@ -1217,37 +1217,37 @@
}
return null;
}
/**
- * Establishes the default bindings of <code>type</code> to
- * <code>classname</code>.
+ * Establishes the default bindings of {@code type} to
+ * {@code classname}.
* 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
- * <code>EditorKit</code> will be loaded with <code>Class.forName</code>
+ * {@code EditorKit} will be loaded with {@code Class.forName}
* when registered with this method.
*
- * @param type the non-<code>null</code> content type
+ * @param type the non-{@code null} content type
* @param classname the class to load later
*/
public static void registerEditorKitForContentType(String type, String classname) {
registerEditorKitForContentType(type, classname,Thread.currentThread().
getContextClassLoader());
}
/**
- * Establishes the default bindings of <code>type</code> to
- * <code>classname</code>.
+ * Establishes the default bindings of {@code type} to
+ * {@code classname}.
* The class will be dynamically loaded later when actually
- * needed using the given <code>ClassLoader</code>,
+ * needed using the given {@code ClassLoader},
* and can be safely changed
* before attempted uses to avoid loading unwanted classes.
*
- * @param type the non-<code>null</code> content type
+ * @param type the non-{@code null} content type
* @param classname the class to load later
- * @param loader the <code>ClassLoader</code> to use to load the name
+ * @param loader the {@code ClassLoader} to use to load the name
*/
public static void registerEditorKitForContentType(String type, String classname, ClassLoader loader) {
getKitTypeRegistry().put(type, classname);
getKitLoaderRegistry().put(type, loader);
getKitRegisty().remove(type);
@@ -1325,12 +1325,12 @@
}
// --- java.awt.Component methods --------------------------
/**
- * Returns the preferred size for the <code>JEditorPane</code>.
- * The preferred size for <code>JEditorPane</code> is slightly altered
+ * Returns the preferred size for the {@code JEditorPane}.
+ * The preferred size for {@code 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
@@ -1338,11 +1338,11 @@
* the <em>normal</em> 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.
*
- * @return a <code>Dimension</code> containing the preferred size
+ * @return a {@code Dimension} containing the preferred size
*/
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
Container parent = SwingUtilities.getUnwrappedParent(this);
if (parent instanceof JViewport) {
@@ -1374,29 +1374,29 @@
}
// --- JTextComponent methods -----------------------------
/**
- * Sets the text of this <code>TextComponent</code> to the specified
+ * Sets the text of this {@code 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 <code>text/html</code>
+ * this editor. For example, if the type is set to {@code text/html}
* the string should be specified in terms of HTML.
* <p>
* This is implemented to remove the contents of the current document,
* and replace them by parsing the given string using the current
- * <code>EditorKit</code>. This gives the semantics of the
+ * {@code EditorKit}. This gives the semantics of the
* superclass by not changing
* out the model, while supporting the content type currently set on
* this component. The assumption is that the previous content is
* relatively
* small, and that the previous content doesn't have side effects.
* Both of those assumptions can be violated and cause undesirable results.
* To avoid this, create a new document,
- * <code>getEditorKit().createDefaultDocument()</code>, and replace the
- * existing <code>Document</code> with the new one. You are then assured the
- * previous <code>Document</code> won't have any lingering state.
+ * {@code getEditorKit().createDefaultDocument()}, and replace the
+ * existing {@code Document} with the new one. You are then assured the
+ * previous {@code Document} won't have any lingering state.
* <ol>
* <li>
* Leaving the existing model in place means that the old view will be
* torn down, and a new view created, where replacing the document would
* avoid the tear down of the old view.
@@ -1409,11 +1409,11 @@
* An alternative way to load this component with a string would be to
* create a StringReader and call the read method. In this case the model
* would be replaced after it was initialized with the contents of the
* string.
*
- * @param t the new text to be set; if <code>null</code> the old
+ * @param t the new text to be set; if {@code null} the old
* text will be deleted
* @see #getText
* @beaninfo
* description: the text of this component
*/
@@ -1433,16 +1433,16 @@
UIManager.getLookAndFeel().provideErrorFeedback(JEditorPane.this);
}
}
/**
- * Returns the text contained in this <code>TextComponent</code>
+ * Returns the text contained in this {@code TextComponent}
* in terms of the
* content type of this editor. If an exception is thrown while
- * attempting to retrieve the text, <code>null</code> will be returned.
- * This is implemented to call <code>JTextComponent.write</code> with
- * a <code>StringWriter</code>.
+ * attempting to retrieve the text, {@code null} will be returned.
+ * This is implemented to call {@code JTextComponent.write} with
+ * a {@code StringWriter}.
*
* @return the text
* @see #setText
*/
public String getText() {
@@ -1459,11 +1459,11 @@
// --- Scrollable ----------------------------------------
/**
* Returns true if a viewport should always force the width of this
- * <code>Scrollable</code> to match the width of the viewport.
+ * {@code Scrollable} to match the width of the viewport.
*
* @return true if a viewport should force the Scrollables width to
* match its own, false otherwise
*/
public boolean getScrollableTracksViewportWidth() {
@@ -1481,14 +1481,14 @@
return false;
}
/**
* Returns true if a viewport should always force the height of this
- * <code>Scrollable</code> to match the height of the viewport.
+ * {@code Scrollable} to match the height of the viewport.
*
* @return true if a viewport should force the
- * <code>Scrollable</code>'s height to match its own,
+ * {@code Scrollable}'s height to match its own,
* false otherwise
*/
public boolean getScrollableTracksViewportHeight() {
Container parent = SwingUtilities.getUnwrappedParent(this);
if (parent instanceof JViewport) {
@@ -1507,12 +1507,12 @@
}
// --- Serialization ------------------------------------
/**
- * See <code>readObject</code> and <code>writeObject</code> in
- * <code>JComponent</code> for more
+ * See {@code readObject} and {@code writeObject} in
+ * {@code JComponent} for more
* information about serialization in Swing.
*/
private void writeObject(ObjectOutputStream s) throws IOException {
s.defaultWriteObject();
if (getUIClassID().equals(uiClassID)) {
@@ -1566,11 +1566,11 @@
* <a href="http://www.w3.org/TR/CSS21/syndata.html#length-units">
* w3c compliant</a> length units are used for html rendering.
* <p>
* By default this is not enabled; to enable
* it set the client {@link #putClientProperty property} with this name
- * to <code>Boolean.TRUE</code>.
+ * to {@code Boolean.TRUE}.
*
* @since 1.5
*/
public static final String W3C_LENGTH_UNITS = "JEditorPane.w3cLengthUnits";
@@ -1580,27 +1580,27 @@
* used if a font or foreground color is not specified in the styled
* text.
* <p>
* The default varies based on the look and feel;
* to enable it set the client {@link #putClientProperty property} with
- * this name to <code>Boolean.TRUE</code>.
+ * this name to {@code Boolean.TRUE}.
*
* @since 1.5
*/
public static final String HONOR_DISPLAY_PROPERTIES = "JEditorPane.honorDisplayProperties";
static final Map<String, String> defaultEditorKitMap = new HashMap<String, String>(0);
/**
- * Returns a string representation of this <code>JEditorPane</code>.
+ * Returns a string representation of this {@code 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 <code>null</code>.
+ * be {@code null}.
*
- * @return a string representation of this <code>JEditorPane</code>
+ * @return a string representation of this {@code JEditorPane}
*/
protected String paramString() {
String kitString = (kit != null ?
kit.toString() : "");
String typeHandlersString = (typeHandlers != null ?
@@ -1639,32 +1639,32 @@
return accessibleContext;
}
/**
* This class implements accessibility support for the
- * <code>JEditorPane</code> class. It provides an implementation of the
+ * {@code JEditorPane} class. It provides an implementation of the
* Java Accessibility API appropriate to editor pane user-interface
* elements.
* <p>
* <strong>Warning:</strong>
* 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. As of 1.4, support for long term storage
* of all JavaBeans™
- * has been added to the <code>java.beans</code> package.
+ * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial") // Same-version serialization only
protected class AccessibleJEditorPane extends AccessibleJTextComponent {
/**
* Gets the accessibleDescription property of this object. If this
* property isn't set, returns the content type of this
- * <code>JEditorPane</code> instead (e.g. "plain/text", "html/text").
+ * {@code JEditorPane} instead (e.g. "plain/text", "html/text").
*
- * @return the localized description of the object; <code>null</code>
+ * @return the localized description of the object; {@code null}
* if this object does not have a description
*
* @see #setAccessibleName
*/
public String getAccessibleDescription() {
@@ -1693,22 +1693,22 @@
return states;
}
}
/**
- * This class provides support for <code>AccessibleHypertext</code>,
- * and is used in instances where the <code>EditorKit</code>
- * installed in this <code>JEditorPane</code> is an instance of
- * <code>HTMLEditorKit</code>.
+ * This class provides support for {@code AccessibleHypertext},
+ * and is used in instances where the {@code EditorKit}
+ * installed in this {@code JEditorPane} is an instance of
+ * {@code HTMLEditorKit}.
* <p>
* <strong>Warning:</strong>
* 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. As of 1.4, support for long term storage
* of all JavaBeans™
- * has been added to the <code>java.beans</code> package.
+ * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial") // Same-version serialization only
protected class AccessibleJEditorPaneHTML extends AccessibleJEditorPane {
@@ -1788,15 +1788,15 @@
}
}
/**
* What's returned by
- * <code>AccessibleJEditorPaneHTML.getAccessibleText</code>.
+ * {@code AccessibleJEditorPaneHTML.getAccessibleText}.
*
- * Provides support for <code>AccessibleHypertext</code> in case
+ * Provides support for {@code AccessibleHypertext} in case
* there is an HTML document being displayed in this
- * <code>JEditorPane</code>.
+ * {@code JEditorPane}.
*
*/
protected class JEditorPaneAccessibleHypertextSupport
extends AccessibleJEditorPane implements AccessibleHypertext {
< prev index next >