📄 jeditorpane.html
字号:
</DL>
</BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="JEditorPane"><FONT COLOR="#FFCC00">·</FONT></A>
<A NAME="JEditorPane(java.lang.String, java.lang.String)">JEditorPane</A> </H3>
</TD> <TD ALIGN=right WIDTH=20%> <FONT SIZE="-2"><A HREF="#_Summary_">Summary</A> | <A HREF=#_top_>Top</A></FONT> </TD> </TR> </TABLE>
<PRE>
public JEditorPane(<A HREF="java.lang.String.html">String</A> type,
<A HREF="java.lang.String.html">String</A> text) </PRE>
<BLOCKQUOTE>
<DL>
<P>
Creates a JEditorPane that has been initialized to the given
text. This is a convenience constructor that calls the
<code>setContentType</code> and <code>setText</code> methods.
<P>
<TABLE WIDTH="87%" BORDER=1 CELLPADDING=3 CELLSPACING=0> <TR VALIGN=TOP BGCOLOR="#CCCCCC"> <TD><B>Parameter</B></TD> <TD><B>Description</B></TD> </TR>
<TR VALIGN=TOP> <TD><I> type</I></TD> <TD>mime type of the given text.</TD></TR>
<TR VALIGN=TOP> <TD><I> text</I></TD> <TD>the text to initialize with.</TD></TR>
</TABLE><P>
</DL>
</BLOCKQUOTE> <BR>
<BR><TABLE BGCOLOR="#00ccff" WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD><FONT FACE="arial,helvetica" SIZE=+1><B> Methods</B></FONT></TD> </TR> </TABLE>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="addHyperlinkListener"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="addHyperlinkListener(javax.swing.event.HyperlinkListener)">addHyperlinkListener</A> </H3>
</TD> <TD ALIGN=right WIDTH=20%> <FONT SIZE="-2"><A HREF="#_Summary_">Summary</A> | <A HREF=#_top_>Top</A></FONT> </TD> </TR> </TABLE>
<PRE>
public synchronized void addHyperlinkListener(<A HREF="javax.swing.event.HyperlinkListener.html">HyperlinkListener</A> listener) </PRE>
<BLOCKQUOTE>
<DL>
<P>
Adds a hyperlink listener for notification of any changes, for example
when a link is selected and entered.
<P>
<TABLE WIDTH="87%" BORDER=1 CELLPADDING=3 CELLSPACING=0> <TR VALIGN=TOP BGCOLOR="#CCCCCC"> <TD><B>Parameter</B></TD> <TD><B>Description</B></TD> </TR>
<TR VALIGN=TOP> <TD><I> listener</I></TD> <TD>the listener</TD></TR>
</TABLE><P>
</DL>
</BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="removeHyperlinkListener"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="removeHyperlinkListener(javax.swing.event.HyperlinkListener)">removeHyperlinkListener</A> </H3>
</TD> <TD ALIGN=right WIDTH=20%> <FONT SIZE="-2"><A HREF="#_Summary_">Summary</A> | <A HREF=#_top_>Top</A></FONT> </TD> </TR> </TABLE>
<PRE>
public synchronized void removeHyperlinkListener(<A HREF="javax.swing.event.HyperlinkListener.html">HyperlinkListener</A> listener) </PRE>
<BLOCKQUOTE>
<DL>
<P>
Removes a hyperlink listener.
<P>
<TABLE WIDTH="87%" BORDER=1 CELLPADDING=3 CELLSPACING=0> <TR VALIGN=TOP BGCOLOR="#CCCCCC"> <TD><B>Parameter</B></TD> <TD><B>Description</B></TD> </TR>
<TR VALIGN=TOP> <TD><I> listener</I></TD> <TD>the listener</TD></TR>
</TABLE><P>
</DL>
</BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="fireHyperlinkUpdate"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="fireHyperlinkUpdate(javax.swing.event.HyperlinkEvent)">fireHyperlinkUpdate</A> </H3>
</TD> <TD ALIGN=right WIDTH=20%> <FONT SIZE="-2"><A HREF="#_Summary_">Summary</A> | <A HREF=#_top_>Top</A></FONT> </TD> </TR> </TABLE>
<PRE>
public void fireHyperlinkUpdate(<A HREF="javax.swing.event.HyperlinkEvent.html">HyperlinkEvent</A> e) </PRE>
<BLOCKQUOTE>
<DL>
<P>
Notifies all listeners that have registered interest for
notification on this event type. This is normally called
by the currently installed EditorKit if a content type
that supports hyperlinks is currently active and there
was activity with a link. The listener list is processed
last to first.
<P>
<TABLE WIDTH="87%" BORDER=1 CELLPADDING=3 CELLSPACING=0> <TR VALIGN=TOP BGCOLOR="#CCCCCC"> <TD><B>Parameter</B></TD> <TD><B>Description</B></TD> </TR>
<TR VALIGN=TOP> <TD><I> e</I></TD> <TD>the event</TD></TR>
</TABLE><P>
</DL>
<P> <B>See Also:</B>
<A HREF="javax.swing.event.EventListenerList.html">EventListenerList</A></BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="setPage"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="setPage(java.net.URL)">setPage</A> </H3>
</TD> <TD ALIGN=right WIDTH=20%> <FONT SIZE="-2"><A HREF="#_Summary_">Summary</A> | <A HREF=#_top_>Top</A></FONT> </TD> </TR> </TABLE>
<PRE>
public void setPage(<A HREF="java.net.URL.html">URL</A> page) throws <A HREF="java.io.IOException.html">IOException</A></PRE>
<BLOCKQUOTE>
<DL>
<P>
Sets the current url being displayed. The content type of the
pane is set, and if the editor kit for the pane is non-null, then
a new default document is created and the URL is read into it.
If the url contains and reference location, the location will
be scrolled to by calling the <code>scrollToReference</code>
method. If the desired URL is not the one currently being
displayed, the <code>getStream</code> method is called to
give subclasses control over the stream provided.
<p>
This may load either synchronously or asynchronously
depending upon the document returned by the EditorKit.
If the Document is of type AbstractDocument and has
a value returned by
<code>AbstractDocument.getAsynchronousLoadPriority</code>
that is greater than or equal to zero, the page will be
loaded on a seperate thread using that priority.
<p>
If the document is loaded synchronously, it will be
filled in with the stream prior to being installed into
the editor with a call to <code>setDocument</code>, which
is bound and will fire a property change event. If an
IOException is thrown the partially loaded document will
be discarded and neither the document or page property
change events will be fired. If the document is
successfully loaded and installed, a view will be
built for it by the UI which will then be scrolled if
necessary, and then the page property change event
will be fired.
<p>
If the document is loaded asynchronously, the document
will be installed into the editor immediately using a
call to <code>setDocument</code> which will fire a
document property change event, then a thread will be
created which will begin doing the actual loading.
In this case, the page property change event will not be
fired by the call to this method directly, but rather will be
fired when the thread doing the loading has finished.
Since the calling thread can not throw an IOException in
the event of failure on the other thread, the page
property change event will be fired when the other
thread is done whether the load was successful or not.
<P>
<TABLE WIDTH="87%" BORDER=1 CELLPADDING=3 CELLSPACING=0> <TR VALIGN=TOP BGCOLOR="#CCCCCC"> <TD><B>Parameter</B></TD> <TD><B>Description</B></TD> </TR>
<TR VALIGN=TOP> <TD><I> page</I></TD> <TD>the URL of the page</TD></TR>
</TABLE><P>
<DT> <B>Throws:</B> <A HREF="java.io.IOException.html">IOException</A>
<DD> for a null or invalid page specification,
or exception from the stream being read.
</DL>
<P> <B>See Also:</B>
<A HREF="#getPage">getPage</A></BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="read"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="read(java.io.InputStream, java.lang.Object)">read</A> </H3>
</TD> <TD ALIGN=right WIDTH=20%> <FONT SIZE="-2"><A HREF="#_Summary_">Summary</A> | <A HREF=#_top_>Top</A></FONT> </TD> </TR> </TABLE>
<PRE>
public void read(<A HREF="java.io.InputStream.html">InputStream</A> in,
<A HREF="java.lang.Object.html">Object</A> desc) throws <A HREF="java.io.IOException.html">IOException</A></PRE>
<BLOCKQUOTE>
<DL>
<P>
This method initializes from a stream. If
the kit is set to be of type HTMLEditorKit,
and the desc parameter is an HTMLDocument,
then it invokes the HTMLEditorKit to initiate
the read. Otherwise it calls the superclass
method which loads the model as plain text.
<P>
<TABLE WIDTH="87%" BORDER=1 CELLPADDING=3 CELLSPACING=0> <TR VALIGN=TOP BGCOLOR="#CCCCCC"> <TD><B>Parameter</B></TD> <TD><B>Description</B></TD> </TR>
<TR VALIGN=TOP> <TD><I> in</I></TD> <TD>The stream to read from</TD></TR>
<TR VALIGN=TOP> <TD><I> desc</I></TD> <TD>An object describing the stream.</TD></TR>
</TABLE><P>
<DT> <B>Throws:</B> <A HREF="java.io.IOException.html">IOException</A>
<DD> as thrown by the stream being
used to initialize.
</DL>
<P> <B>See Also:</B>
<A HREF="javax.swing.text.JTextComponent.html#read">read</A>, <A HREF="#setDocument">setDocument</A></BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="getStream"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="getStream(java.net.URL)">getStream</A> </H3>
</TD> <TD ALIGN=right WIDTH=20%> <FONT SIZE="-2"><A HREF="#_Summary_">Summary</A> | <A HREF=#_top_>Top</A></FONT> </TD> </TR> </TABLE>
<PRE>
protected <A HREF="java.io.InputStream.html">InputStream</A> getStream(<A HREF="java.net.URL.html">URL</A> page) throws <A HREF="java.io.IOException.html">IOException</A></PRE>
<BLOCKQUOTE>
<DL>
<P>
Fetch a stream for the given url, which is about to
be loaded by the <code>setPage</code> method. By
default, this simply opens the url and returns the
stream. This can be reimplemented to do useful things
like fetch the stream from a cache, monitor the progress
of the stream, etc.
<p>
This method is expected to have the the side effect of
establising the content type, and therefore setting the
appropriate EditorKit to use for loading the stream.
<P>
</DL>
</BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="scrollToReference"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="scrollToReference(java.lang.String)">scrollToReference</A> </H3>
</TD> <TD ALIGN=right WIDTH=20%> <FONT SIZE="-2"><A HREF="#_Summary_">Summary</A> | <A HREF=#_top_>Top</A></FONT> </TD> </TR> </TABLE>
<PRE>
protected void scrollToReference(<A HREF="java.lang.String.html">String</A> reference) </PRE>
<BLOCKQUOTE>
<DL>
<P>
Scroll the view to the given reference location
(i.e. the value returned by the <code>UL.getRef</code>
method for the url being displayed). By default, this
method only knows how to locate a reference in an
HTMLDocument. The implementation calls the
<code>scrollRectToVisible</code> method to
accomplish the actual scrolling. If scrolling to a
reference location is needed for document types other
than html, this method should be reimplemented.
This method will have no effect if the component
is not visible.
<P>
<TABLE WIDTH="87%" BORDER=1 CELLPADDING=3 CELLSPACING=0> <TR VALIGN=TOP BGCOLOR="#CCCCCC"> <TD><B>Parameter</B></TD> <TD><B>Description</B></TD> </TR>
<TR VALIGN=TOP> <TD><I> reference</I></TD> <TD>the named location to scroll to.</TD></TR>
</TABLE><P>
</DL>
</BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="getPage"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="getPage()">getPage</A> </H3>
</TD> <TD ALIGN=right WIDTH=20%> <FONT SIZE="-2"><A HREF="#_Summary_">Summary</A> | <A HREF=#_top_>Top</A></FONT> </TD> </TR> </TABLE>
<PRE>
public <A HREF="java.net.URL.html">URL</A> getPage() </PRE>
<BLOCKQUOTE>
<DL>
<P>
Gets the current url being displayed. If a URL was
not specified in the creation of the document, this
will return null, and relative URL's will not be
resolved.
<P>
<DT> <B>Returns:</B>
<DD> the URL
</DL>
</BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="setPage"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="setPage(java.lang.String)">setPage</A> </H3>
</TD> <TD ALIGN=right WIDTH=20%> <FONT SIZE="-2"><A HREF="#_Summary_">Summary</A> | <A HREF=#_top_>Top</A></FONT> </TD> </TR> </TABLE>
<PRE>
public void setPage(<A HREF="java.lang.String.html">String</A> url) throws <A HREF="java.io.IOException.html">IOException</A></PRE>
<BLOCKQUOTE>
<DL>
<P>
Sets the current url being displayed.
<P>
<TABLE WIDTH="87%" BORDER=1 CELLPADDING=3 CELLSPACING=0> <TR VALIGN=TOP BGCOLOR="#CCCCCC"> <TD><B>Parameter</B></TD> <TD><B>Description</B></TD> </TR>
<TR VALIGN=TOP> <TD><I> url</I></TD> <TD>the URL for display</TD></TR>
</TABLE><P>
<DT> <B>Throws:</B> <A HREF="java.io.IOException.html">IOException</A>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -