jdk/src/share/classes/javax/swing/JEditorPane.java
Print this page
*** 22,40 ****
* 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.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.*;
--- 22,38 ----
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.swing;
import java.awt.*;
! import java.beans.JavaBean;
! import java.beans.BeanProperty;
import java.lang.reflect.*;
import java.net.*;
import java.util.*;
import java.io.*;
import javax.swing.plaf.*;
import javax.swing.text.*;
import javax.swing.event.*;
import javax.swing.text.html.*;
*** 182,198 ****
* 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
*/
@SuppressWarnings("serial") // Same-version serialization only
public class JEditorPane extends JTextComponent {
/**
* Creates a new <code>JEditorPane</code>.
--- 180,194 ----
* 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}.
*
* @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,330 ****
--- 317,327 ----
*
* @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,423 ****
*
* @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
*/
public void setPage(URL page) throws IOException {
if (page == null) {
throw new IOException("invalid url");
}
URL loaded = getPage();
--- 406,418 ----
*
* @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
*/
+ @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();
*** 891,900 ****
--- 886,896 ----
*
* @return the string "EditorPaneUI"
* @see JComponent#getUIClassID
* @see UIDefaults#getUI
*/
+ @BeanProperty(bound = false)
public String getUIClassID() {
return uiClassID;
}
/**
*** 956,970 ****
* 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>
*/
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(';');
--- 952,966 ----
* for plain text, <code>text/plain</code>.
*
* @param type the non-<code>null</code> mime type for the content editing
* support
* @see #getContentType
* @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(';');
*** 1042,1056 ****
* 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
*/
public void setEditorKit(EditorKit kit) {
EditorKit old = this.kit;
isUserSetEditorKit = true;
if (old != null) {
old.deinstall(this);
--- 1038,1050 ----
* to be called on behalf of the caller to ensure integrity
* of the internal state.</em>
*
* @param kit the desired editor behavior
* @see #getEditorKit
*/
+ @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);
*** 1410,1422 ****
* 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
*/
public void setText(String t) {
try {
Document doc = getDocument();
doc.remove(0, doc.getLength());
if (t == null || t.equals("")) {
--- 1404,1416 ----
* string.
*
* @param t the new text to be set; if <code>null</code> the old
* text will be deleted
* @see #getText
*/
+ @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("")) {
*** 1462,1471 ****
--- 1456,1466 ----
* <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();
*** 1485,1494 ****
--- 1480,1490 ----
*
* @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();
*** 1622,1631 ****
--- 1618,1628 ----
* 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();