< prev index next >
src/java.desktop/share/classes/javax/swing/JTextPane.java
Print this page
@@ -67,11 +67,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 true
* description: A text component that can be marked up with attributes that are graphically represented.
@@ -82,13 +82,13 @@
*/
@SuppressWarnings("serial") // Same-version serialization only
public class JTextPane extends JEditorPane {
/**
- * Creates a new <code>JTextPane</code>. A new instance of
- * <code>StyledEditorKit</code> is
- * created and set, and the document model set to <code>null</code>.
+ * Creates a new {@code JTextPane}. A new instance of
+ * {@code StyledEditorKit} is
+ * created and set, and the document model set to {@code null}.
*/
public JTextPane() {
super();
EditorKit editorKit = createDefaultEditorKit();
String contentType = editorKit.getContentType();
@@ -99,12 +99,12 @@
}
setEditorKit(editorKit);
}
/**
- * Creates a new <code>JTextPane</code>, with a specified document model.
- * A new instance of <code>javax.swing.text.StyledEditorKit</code>
+ * Creates a new {@code JTextPane}, with a specified document model.
+ * A new instance of {@code javax.swing.text.StyledEditorKit}
* is created and set.
*
* @param doc the document model
*/
public JTextPane(StyledDocument doc) {
@@ -124,15 +124,15 @@
return uiClassID;
}
/**
* Associates the editor with a text document. This
- * must be a <code>StyledDocument</code>.
+ * must be a {@code StyledDocument}.
*
* @param doc the document to display/edit
- * @exception IllegalArgumentException if <code>doc</code> can't
- * be narrowed to a <code>StyledDocument</code> which is the
+ * @exception IllegalArgumentException if {@code doc} can't
+ * be narrowed to a {@code StyledDocument} which is the
* required type of model for this text component
*/
public void setDocument(Document doc) {
if (doc instanceof StyledDocument) {
super.setDocument(doc);
@@ -223,14 +223,14 @@
* one container, this method should not be used in situations
* where the model is shared by text components.
* <p>
* The component is placed relative to the text baseline
* according to the value returned by
- * <code>Component.getAlignmentY</code>. For Swing components
+ * {@code Component.getAlignmentY}. For Swing components
* this value can be conveniently set using the method
- * <code>JComponent.setAlignmentY</code>. For example, setting
- * a value of <code>0.75</code> will cause 75 percent of the
+ * {@code JComponent.setAlignmentY}. For example, setting
+ * a value of {@code 0.75} will cause 75 percent of the
* component to be above the baseline, and 25 percent of the
* component to be below the baseline.
*
* @param c the component to insert
*/
@@ -265,42 +265,42 @@
* Adds a new style into the logical style hierarchy. Style attributes
* resolve from bottom up so an attribute specified in a child
* will override an attribute specified in the parent.
*
* @param nm the name of the style (must be unique within the
- * collection of named styles). The name may be <code>null</code>
+ * collection of named styles). The name may be {@code null}
* if the style is unnamed, but the caller is responsible
* for managing the reference returned as an unnamed style can't
* be fetched by name. An unnamed style may be useful for things
* like character attribute overrides such as found in a style
* run.
- * @param parent the parent style. This may be <code>null</code>
+ * @param parent the parent style. This may be {@code null}
* if unspecified
* attributes need not be resolved in some other style.
- * @return the new <code>Style</code>
+ * @return the new {@code Style}
*/
public Style addStyle(String nm, Style parent) {
StyledDocument doc = getStyledDocument();
return doc.addStyle(nm, parent);
}
/**
- * Removes a named non-<code>null</code> style previously added to
+ * Removes a named non-{@code null} style previously added to
* the document.
*
* @param nm the name of the style to remove
*/
public void removeStyle(String nm) {
StyledDocument doc = getStyledDocument();
doc.removeStyle(nm);
}
/**
- * Fetches a named non-<code>null</code> style previously added.
+ * Fetches a named non-{@code null} style previously added.
*
* @param nm the name of the style
- * @return the <code>Style</code>
+ * @return the {@code Style}
*/
public Style getStyle(String nm) {
StyledDocument doc = getStyledDocument();
return doc.getStyle(nm);
}
@@ -312,33 +312,33 @@
* through the logical style assigned to the paragraph, which
* in term may resolve through some hierarchy completely
* independent of the element hierarchy in the document.
*
* @param s the logical style to assign to the paragraph,
- * or <code>null</code> for no style
+ * or {@code null} for no style
*/
public void setLogicalStyle(Style s) {
StyledDocument doc = getStyledDocument();
doc.setLogicalStyle(getCaretPosition(), s);
}
/**
* Fetches the logical style assigned to the paragraph represented
- * by the current position of the caret, or <code>null</code>.
+ * by the current position of the caret, or {@code null}.
*
- * @return the <code>Style</code>
+ * @return the {@code Style}
*/
public Style getLogicalStyle() {
StyledDocument doc = getStyledDocument();
return doc.getLogicalStyle(getCaretPosition());
}
/**
* Fetches the character attributes in effect at the
- * current location of the caret, or <code>null</code>.
+ * current location of the caret, or {@code null}.
*
- * @return the attributes, or <code>null</code>
+ * @return the attributes, or {@code null}
*/
public AttributeSet getCharacterAttributes() {
StyledDocument doc = getStyledDocument();
Element run = doc.getCharacterElement(getCaretPosition());
if (run != null) {
@@ -373,11 +373,11 @@
}
}
/**
* Fetches the current paragraph attributes in effect
- * at the location of the caret, or <code>null</code> if none.
+ * at the location of the caret, or {@code null} if none.
*
* @return the attributes
*/
public AttributeSet getParagraphAttributes() {
StyledDocument doc = getStyledDocument();
@@ -393,11 +393,11 @@
* there is a selection, the attributes are applied
* to the paragraphs that intersect the selection.
* If there is no selection, the attributes are applied
* to the paragraph at the current caret position.
*
- * @param attr the non-<code>null</code> attributes
+ * @param attr the non-{@code null} attributes
* @param replace if true, replace the existing attributes first
*/
public void setParagraphAttributes(AttributeSet attr, boolean replace) {
int p0 = getSelectionStart();
int p1 = getSelectionEnd();
@@ -429,12 +429,12 @@
*/
private static final String uiClassID = "TextPaneUI";
/**
- * 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.
*
* @param s the output stream
*/
private void writeObject(ObjectOutputStream s) throws IOException {
@@ -450,12 +450,12 @@
// --- JEditorPane ------------------------------------
/**
- * Creates the <code>EditorKit</code> to use by default. This
- * is implemented to return <code>javax.swing.text.StyledEditorKit</code>.
+ * Creates the {@code EditorKit} to use by default. This
+ * is implemented to return {@code javax.swing.text.StyledEditorKit}.
*
* @return the editor kit
*/
protected EditorKit createDefaultEditorKit() {
return new StyledEditorKit();
@@ -466,29 +466,29 @@
* content. This is the bound property that
* establishes the content type of the editor.
*
* @param kit the desired editor behavior
* @exception IllegalArgumentException if kit is not a
- * <code>StyledEditorKit</code>
+ * {@code StyledEditorKit}
*/
public final void setEditorKit(EditorKit kit) {
if (kit instanceof StyledEditorKit) {
super.setEditorKit(kit);
} else {
throw new IllegalArgumentException("Must be StyledEditorKit");
}
}
/**
- * Returns a string representation of this <code>JTextPane</code>.
+ * Returns a string representation of this {@code JTextPane}.
* 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>JTextPane</code>
+ * @return a string representation of this {@code JTextPane}
*/
protected String paramString() {
return super.paramString();
}
< prev index next >