⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jeditorpane.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 5 页
字号:
 Some kinds of content may provide hyperlink support by generating hyperlink events.  The HTML <code>EditorKit</code> will generate hyperlink events if the <code>JEditorPane</code> is <em>not editable</em>  (<code>JEditorPane.setEditable(false);</code> has been called). If HTML frames are embedded in the document, the typical response would be to change a portion of the current document.  The following code fragment is a possible hyperlink listener implementation, that treats  HTML frame events specially, and simply displays any other activated hyperlinks. <code><pre>&nbsp;    class Hyperactive implements HyperlinkListener {&nbsp;&nbsp;        public void hyperlinkUpdate(HyperlinkEvent e) {&nbsp;	          if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {&nbsp;		      JEditorPane pane = (JEditorPane) e.getSource();&nbsp;		      if (e instanceof HTMLFrameHyperlinkEvent) {&nbsp;		          HTMLFrameHyperlinkEvent  evt = (HTMLFrameHyperlinkEvent)e;&nbsp;		          HTMLDocument doc = (HTMLDocument)pane.getDocument();&nbsp;		          doc.processHTMLFrameHyperlinkEvent(evt);&nbsp;		      } else {&nbsp;		          try {&nbsp;			      pane.setPage(e.getURL());&nbsp;		          } catch (Throwable t) {&nbsp;			      t.printStackTrace();&nbsp;		          }&nbsp;		      }&nbsp;	          }&nbsp;	      }&nbsp;    } </pre></code> <p> Culturally dependent information in some documents is handled through a mechanism called character encoding.  Character encoding is an unambiguous mapping of the members of a character set (letters, ideographs, digits, symbols, or control functions) to specific numeric code values. It represents the way the file is stored. Example character encodings are ISO-8859-1, ISO-8859-5, Shift-jis, Euc-jp, and UTF-8. When the file is  passed to an user agent (<code>JEditorPane</code>) it is converted to the document character set (ISO-10646 aka Unicode). <p> There are multiple ways to get a character set mapping to happen  with <code>JEditorPane</code>.   <ol> <li> One way is to specify the character set as a parameter of the MIME  type.  This will be established by a call to the  <a href="#setContentType">setContentType</a> method.  If the content is loaded by the <a href="#setPage">setPage</a> method the content type will have been set according to the specification of the URL. It the file is loaded directly, the content type would be expected to have been set prior to loading. <li> Another way the character set can be specified is in the document itself. This requires reading the document prior to determining the character set that is desired.  To handle this, it is expected that the  <code>EditorKit</code>.read operation throw a <code>ChangedCharSetException</code> which will be caught.  The read is then restarted with a new Reader that uses the character set specified in the <code>ChangedCharSetException</code> (which is an <code>IOException</code>). </ol> <p> <strong>Warning:</strong> 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.  A future release of Swing will provide support for long term persistence.<P><DL><DT><B>See Also: </B><DD><A HREF="../../serialized-form.html#javax.swing.JEditorPane">Serialized Form</A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><A NAME="inner_class_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Inner Class Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;class</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/JEditorPane.AccessibleJEditorPane.html">JEditorPane.AccessibleJEditorPane</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This class implements accessibility support for the  <code>JEditorPane</code> class.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;class</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/JEditorPane.AccessibleJEditorPaneHTML.html">JEditorPane.AccessibleJEditorPaneHTML</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This class provides support for <code>AccessibleHypertext</code>, and is used in instances where the <code>EditorKit</code> installed in this <code>JEditorPane</code> is an instance of <code>HTMLEditorKit</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;class</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/JEditorPane.JEditorPaneAccessibleHypertextSupport.html">JEditorPane.JEditorPaneAccessibleHypertextSupport</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;What's returned by <code>AccessibleJEditorPaneHTML.getAccessibleText</code>.</TD></TR></TABLE>&nbsp;<A NAME="inner_classes_inherited_from_class_javax.swing.text.JTextComponent"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Inner classes inherited from class javax.swing.text.<A HREF="../../javax/swing/text/JTextComponent.html">JTextComponent</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../javax/swing/text/JTextComponent.AccessibleJTextComponent.html">JTextComponent.AccessibleJTextComponent</A>, <A HREF="../../javax/swing/text/JTextComponent.KeyBinding.html">JTextComponent.KeyBinding</A></CODE></TD></TR></TABLE>&nbsp;<A NAME="inner_classes_inherited_from_class_javax.swing.JComponent"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Inner classes inherited from class javax.swing.<A HREF="../../javax/swing/JComponent.html">JComponent</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../javax/swing/JComponent.AccessibleJComponent.html">JComponent.AccessibleJComponent</A></CODE></TD></TR></TABLE>&nbsp;<A NAME="inner_classes_inherited_from_class_java.awt.Container"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Inner classes inherited from class java.awt.<A HREF="../../java/awt/Container.html">Container</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/awt/Container.AccessibleAWTContainer.html">Container.AccessibleAWTContainer</A></CODE></TD></TR></TABLE>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -