src/share/classes/javax/swing/JEditorPane.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 143  * with <code>JEditorPane</code>.
 144  * <ol>
 145  * <li>
 146  * One way is to specify the character set as a parameter of the MIME
 147  * type.  This will be established by a call to the
 148  * {@link #setContentType setContentType} method.  If the content
 149  * is loaded by the {@link #setPage setPage} method the content
 150  * type will have been set according to the specification of the URL.
 151  * It the file is loaded directly, the content type would be expected to
 152  * have been set prior to loading.
 153  * <li>
 154  * Another way the character set can be specified is in the document itself.
 155  * This requires reading the document prior to determining the character set
 156  * that is desired.  To handle this, it is expected that the
 157  * <code>EditorKit</code>.read operation throw a
 158  * <code>ChangedCharSetException</code> which will
 159  * be caught.  The read is then restarted with a new Reader that uses
 160  * the character set specified in the <code>ChangedCharSetException</code>
 161  * (which is an <code>IOException</code>).
 162  * </ol>
 163  * <p>
 164  * <dl>
 165  * <dt><b><font size=+1>Newlines</font></b>
 166  * <dd>
 167  * For a discussion on how newlines are handled, see
 168  * <a href="text/DefaultEditorKit.html">DefaultEditorKit</a>.
 169  * </dl>
 170  *
 171  * <p>
 172  * <strong>Warning:</strong> Swing is not thread safe. For more
 173  * information see <a
 174  * href="package-summary.html#threading">Swing's Threading
 175  * Policy</a>.
 176  * <p>
 177  * <strong>Warning:</strong>
 178  * Serialized objects of this class will not be compatible with
 179  * future Swing releases. The current serialization support is
 180  * appropriate for short term storage or RMI between applications running
 181  * the same version of Swing.  As of 1.4, support for long term storage
 182  * of all JavaBeans&trade;
 183  * has been added to the <code>java.beans</code> package.
 184  * Please see {@link java.beans.XMLEncoder}.
 185  *


   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 143  * with <code>JEditorPane</code>.
 144  * <ol>
 145  * <li>
 146  * One way is to specify the character set as a parameter of the MIME
 147  * type.  This will be established by a call to the
 148  * {@link #setContentType setContentType} method.  If the content
 149  * is loaded by the {@link #setPage setPage} method the content
 150  * type will have been set according to the specification of the URL.
 151  * It the file is loaded directly, the content type would be expected to
 152  * have been set prior to loading.
 153  * <li>
 154  * Another way the character set can be specified is in the document itself.
 155  * This requires reading the document prior to determining the character set
 156  * that is desired.  To handle this, it is expected that the
 157  * <code>EditorKit</code>.read operation throw a
 158  * <code>ChangedCharSetException</code> which will
 159  * be caught.  The read is then restarted with a new Reader that uses
 160  * the character set specified in the <code>ChangedCharSetException</code>
 161  * (which is an <code>IOException</code>).
 162  * </ol>
 163  *
 164  * <dl>
 165  * <dt><b>Newlines</b>
 166  * <dd>
 167  * For a discussion on how newlines are handled, see
 168  * <a href="text/DefaultEditorKit.html">DefaultEditorKit</a>.
 169  * </dl>
 170  *
 171  * <p>
 172  * <strong>Warning:</strong> Swing is not thread safe. For more
 173  * information see <a
 174  * href="package-summary.html#threading">Swing's Threading
 175  * Policy</a>.
 176  * <p>
 177  * <strong>Warning:</strong>
 178  * Serialized objects of this class will not be compatible with
 179  * future Swing releases. The current serialization support is
 180  * appropriate for short term storage or RMI between applications running
 181  * the same version of Swing.  As of 1.4, support for long term storage
 182  * of all JavaBeans&trade;
 183  * has been added to the <code>java.beans</code> package.
 184  * Please see {@link java.beans.XMLEncoder}.
 185  *