161 * </ol>
162 *
163 * <dl>
164 * <dt><b>Newlines</b>
165 * <dd>
166 * For a discussion on how newlines are handled, see
167 * <a href="text/DefaultEditorKit.html">DefaultEditorKit</a>.
168 * </dl>
169 *
170 * <p>
171 * <strong>Warning:</strong> Swing is not thread safe. For more
172 * information see <a
173 * href="package-summary.html#threading">Swing's Threading
174 * Policy</a>.
175 * <p>
176 * <strong>Warning:</strong>
177 * Serialized objects of this class will not be compatible with
178 * future Swing releases. The current serialization support is
179 * appropriate for short term storage or RMI between applications running
180 * the same version of Swing. As of 1.4, support for long term storage
181 * of all JavaBeans™
182 * has been added to the <code>java.beans</code> package.
183 * Please see {@link java.beans.XMLEncoder}.
184 *
185 * @author Timothy Prinzing
186 * @since 1.2
187 */
188 @JavaBean(defaultProperty = "UIClassID", description = "A text component to edit various types of content.")
189 @SwingContainer(false)
190 @SuppressWarnings("serial") // Same-version serialization only
191 public class JEditorPane extends JTextComponent {
192
193 /**
194 * Creates a new <code>JEditorPane</code>.
195 * The document model is set to <code>null</code>.
196 */
197 public JEditorPane() {
198 super();
199 setFocusCycleRoot(true);
200 setFocusTraversalPolicy(new LayoutFocusTraversalPolicy() {
201 public Component getComponentAfter(Container focusCycleRoot,
1635 accessibleContext = new AccessibleJEditorPaneHTML();
1636 }
1637 } else if (accessibleContext == null || accessibleContext.getClass() !=
1638 AccessibleJEditorPane.class) {
1639 accessibleContext = new AccessibleJEditorPane();
1640 }
1641 return accessibleContext;
1642 }
1643
1644 /**
1645 * This class implements accessibility support for the
1646 * <code>JEditorPane</code> class. It provides an implementation of the
1647 * Java Accessibility API appropriate to editor pane user-interface
1648 * elements.
1649 * <p>
1650 * <strong>Warning:</strong>
1651 * Serialized objects of this class will not be compatible with
1652 * future Swing releases. The current serialization support is
1653 * appropriate for short term storage or RMI between applications running
1654 * the same version of Swing. As of 1.4, support for long term storage
1655 * of all JavaBeans™
1656 * has been added to the <code>java.beans</code> package.
1657 * Please see {@link java.beans.XMLEncoder}.
1658 */
1659 @SuppressWarnings("serial") // Same-version serialization only
1660 protected class AccessibleJEditorPane extends AccessibleJTextComponent {
1661
1662 /**
1663 * Gets the accessibleDescription property of this object. If this
1664 * property isn't set, returns the content type of this
1665 * <code>JEditorPane</code> instead (e.g. "plain/text", "html/text").
1666 *
1667 * @return the localized description of the object; <code>null</code>
1668 * if this object does not have a description
1669 *
1670 * @see #setAccessibleName
1671 */
1672 public String getAccessibleDescription() {
1673 String description = accessibleDescription;
1674
1675 // fallback to client property
1690 * @see AccessibleStateSet
1691 */
1692 public AccessibleStateSet getAccessibleStateSet() {
1693 AccessibleStateSet states = super.getAccessibleStateSet();
1694 states.add(AccessibleState.MULTI_LINE);
1695 return states;
1696 }
1697 }
1698
1699 /**
1700 * This class provides support for <code>AccessibleHypertext</code>,
1701 * and is used in instances where the <code>EditorKit</code>
1702 * installed in this <code>JEditorPane</code> is an instance of
1703 * <code>HTMLEditorKit</code>.
1704 * <p>
1705 * <strong>Warning:</strong>
1706 * Serialized objects of this class will not be compatible with
1707 * future Swing releases. The current serialization support is
1708 * appropriate for short term storage or RMI between applications running
1709 * the same version of Swing. As of 1.4, support for long term storage
1710 * of all JavaBeans™
1711 * has been added to the <code>java.beans</code> package.
1712 * Please see {@link java.beans.XMLEncoder}.
1713 */
1714 @SuppressWarnings("serial") // Same-version serialization only
1715 protected class AccessibleJEditorPaneHTML extends AccessibleJEditorPane {
1716
1717 private AccessibleContext accessibleContext;
1718
1719 /**
1720 * Returns the accessible text.
1721 * @return the accessible text
1722 */
1723 public AccessibleText getAccessibleText() {
1724 return new JEditorPaneAccessibleHypertextSupport();
1725 }
1726
1727 /**
1728 * Constructs an {@code AccessibleJEditorPaneHTML}.
1729 */
1730 protected AccessibleJEditorPaneHTML () {
|
161 * </ol>
162 *
163 * <dl>
164 * <dt><b>Newlines</b>
165 * <dd>
166 * For a discussion on how newlines are handled, see
167 * <a href="text/DefaultEditorKit.html">DefaultEditorKit</a>.
168 * </dl>
169 *
170 * <p>
171 * <strong>Warning:</strong> Swing is not thread safe. For more
172 * information see <a
173 * href="package-summary.html#threading">Swing's Threading
174 * Policy</a>.
175 * <p>
176 * <strong>Warning:</strong>
177 * Serialized objects of this class will not be compatible with
178 * future Swing releases. The current serialization support is
179 * appropriate for short term storage or RMI between applications running
180 * the same version of Swing. As of 1.4, support for long term storage
181 * of all JavaBeans
182 * has been added to the <code>java.beans</code> package.
183 * Please see {@link java.beans.XMLEncoder}.
184 *
185 * @author Timothy Prinzing
186 * @since 1.2
187 */
188 @JavaBean(defaultProperty = "UIClassID", description = "A text component to edit various types of content.")
189 @SwingContainer(false)
190 @SuppressWarnings("serial") // Same-version serialization only
191 public class JEditorPane extends JTextComponent {
192
193 /**
194 * Creates a new <code>JEditorPane</code>.
195 * The document model is set to <code>null</code>.
196 */
197 public JEditorPane() {
198 super();
199 setFocusCycleRoot(true);
200 setFocusTraversalPolicy(new LayoutFocusTraversalPolicy() {
201 public Component getComponentAfter(Container focusCycleRoot,
1635 accessibleContext = new AccessibleJEditorPaneHTML();
1636 }
1637 } else if (accessibleContext == null || accessibleContext.getClass() !=
1638 AccessibleJEditorPane.class) {
1639 accessibleContext = new AccessibleJEditorPane();
1640 }
1641 return accessibleContext;
1642 }
1643
1644 /**
1645 * This class implements accessibility support for the
1646 * <code>JEditorPane</code> class. It provides an implementation of the
1647 * Java Accessibility API appropriate to editor pane user-interface
1648 * elements.
1649 * <p>
1650 * <strong>Warning:</strong>
1651 * Serialized objects of this class will not be compatible with
1652 * future Swing releases. The current serialization support is
1653 * appropriate for short term storage or RMI between applications running
1654 * the same version of Swing. As of 1.4, support for long term storage
1655 * of all JavaBeans
1656 * has been added to the <code>java.beans</code> package.
1657 * Please see {@link java.beans.XMLEncoder}.
1658 */
1659 @SuppressWarnings("serial") // Same-version serialization only
1660 protected class AccessibleJEditorPane extends AccessibleJTextComponent {
1661
1662 /**
1663 * Gets the accessibleDescription property of this object. If this
1664 * property isn't set, returns the content type of this
1665 * <code>JEditorPane</code> instead (e.g. "plain/text", "html/text").
1666 *
1667 * @return the localized description of the object; <code>null</code>
1668 * if this object does not have a description
1669 *
1670 * @see #setAccessibleName
1671 */
1672 public String getAccessibleDescription() {
1673 String description = accessibleDescription;
1674
1675 // fallback to client property
1690 * @see AccessibleStateSet
1691 */
1692 public AccessibleStateSet getAccessibleStateSet() {
1693 AccessibleStateSet states = super.getAccessibleStateSet();
1694 states.add(AccessibleState.MULTI_LINE);
1695 return states;
1696 }
1697 }
1698
1699 /**
1700 * This class provides support for <code>AccessibleHypertext</code>,
1701 * and is used in instances where the <code>EditorKit</code>
1702 * installed in this <code>JEditorPane</code> is an instance of
1703 * <code>HTMLEditorKit</code>.
1704 * <p>
1705 * <strong>Warning:</strong>
1706 * Serialized objects of this class will not be compatible with
1707 * future Swing releases. The current serialization support is
1708 * appropriate for short term storage or RMI between applications running
1709 * the same version of Swing. As of 1.4, support for long term storage
1710 * of all JavaBeans
1711 * has been added to the <code>java.beans</code> package.
1712 * Please see {@link java.beans.XMLEncoder}.
1713 */
1714 @SuppressWarnings("serial") // Same-version serialization only
1715 protected class AccessibleJEditorPaneHTML extends AccessibleJEditorPane {
1716
1717 private AccessibleContext accessibleContext;
1718
1719 /**
1720 * Returns the accessible text.
1721 * @return the accessible text
1722 */
1723 public AccessibleText getAccessibleText() {
1724 return new JEditorPaneAccessibleHypertextSupport();
1725 }
1726
1727 /**
1728 * Constructs an {@code AccessibleJEditorPaneHTML}.
1729 */
1730 protected AccessibleJEditorPaneHTML () {
|