src/java.desktop/share/classes/javax/swing/JEditorPane.java
Print this page
@@ -22,19 +22,17 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.swing;
-import sun.swing.SwingUtilities2;
-
import java.awt.*;
-import java.awt.event.*;
+import java.beans.JavaBean;
+import java.beans.BeanProperty;
import java.lang.reflect.*;
import java.net.*;
import java.util.*;
import java.io.*;
-import java.util.*;
import javax.swing.plaf.*;
import javax.swing.text.*;
import javax.swing.event.*;
import javax.swing.text.html.*;
@@ -182,17 +180,15 @@
* 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.
* Please see {@link java.beans.XMLEncoder}.
*
- * @beaninfo
- * attribute: isContainer false
- * description: A text component to edit various types of content.
- *
* @author Timothy Prinzing
* @since 1.2
*/
+@JavaBean(defaultProperty = "UIClassID", description = "A text component to edit various types of content.")
+@SwingContainer(false)
@SuppressWarnings("serial") // Same-version serialization only
public class JEditorPane extends JTextComponent {
/**
* Creates a new <code>JEditorPane</code>.
@@ -321,10 +317,11 @@
*
* @return all of the <code>HyperLinkListener</code>s added or an empty
* array if no listeners have been added
* @since 1.4
*/
+ @BeanProperty(bound = false)
public synchronized HyperlinkListener[] getHyperlinkListeners() {
return listenerList.getListeners(javax.swing.event.HyperlinkListener.class);
}
/**
@@ -409,15 +406,13 @@
*
* @param page the URL of the page
* @exception IOException for a <code>null</code> or invalid
* page specification, or exception from the stream being read
* @see #getPage
- * @beaninfo
- * description: the URL used to set content
- * bound: true
- * expert: true
*/
+ @BeanProperty(expert = true, description
+ = "the URL used to set content")
public void setPage(URL page) throws IOException {
if (page == null) {
throw new IOException("invalid url");
}
URL loaded = getPage();
@@ -893,10 +888,11 @@
*
* @return the string "EditorPaneUI"
* @see JComponent#getUIClassID
* @see UIDefaults#getUI
*/
+ @BeanProperty(bound = false)
public String getUIClassID() {
return uiClassID;
}
/**
@@ -958,15 +954,15 @@
* for plain text, <code>text/plain</code>.
*
* @param type the non-<code>null</code> 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>
*/
+ @BeanProperty(bound = false, description
+ = "the type of content")
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.
int parm = type.indexOf(';');
@@ -1044,15 +1040,13 @@
* to be called on behalf of the caller to ensure integrity
* of the internal state.</em>
*
* @param kit the desired editor behavior
* @see #getEditorKit
- * @beaninfo
- * description: the currently installed kit for handling content
- * bound: true
- * expert: true
*/
+ @BeanProperty(expert = true, description
+ = "the currently installed kit for handling content")
public void setEditorKit(EditorKit kit) {
EditorKit old = this.kit;
isUserSetEditorKit = true;
if (old != null) {
old.deinstall(this);
@@ -1412,13 +1406,13 @@
* string.
*
* @param t the new text to be set; if <code>null</code> the old
* text will be deleted
* @see #getText
- * @beaninfo
- * description: the text of this component
*/
+ @BeanProperty(bound = false, description
+ = "the text of this component")
public void setText(String t) {
try {
Document doc = getDocument();
doc.remove(0, doc.getLength());
if (t == null || t.equals("")) {
@@ -1464,10 +1458,11 @@
* <code>Scrollable</code> to match the width of the viewport.
*
* @return true if a viewport should force the Scrollables width to
* match its own, false otherwise
*/
+ @BeanProperty(bound = false)
public boolean getScrollableTracksViewportWidth() {
Container parent = SwingUtilities.getUnwrappedParent(this);
if (parent instanceof JViewport) {
JViewport port = (JViewport) parent;
TextUI ui = getUI();
@@ -1487,10 +1482,11 @@
*
* @return true if a viewport should force the
* <code>Scrollable</code>'s height to match its own,
* false otherwise
*/
+ @BeanProperty(bound = false)
public boolean getScrollableTracksViewportHeight() {
Container parent = SwingUtilities.getUnwrappedParent(this);
if (parent instanceof JViewport) {
JViewport port = (JViewport) parent;
TextUI ui = getUI();
@@ -1624,10 +1620,11 @@
* A new AccessibleJEditorPane instance is created if necessary.
*
* @return an AccessibleJEditorPane that serves as the
* AccessibleContext of this JEditorPane
*/
+ @BeanProperty(bound = false)
public AccessibleContext getAccessibleContext() {
if (getEditorKit() instanceof HTMLEditorKit) {
if (accessibleContext == null || accessibleContext.getClass() !=
AccessibleJEditorPaneHTML.class) {
accessibleContext = new AccessibleJEditorPaneHTML();