📄 jeditorpane.html
字号:
<DD> for a null or invalid URL specification
</DL>
</BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="getUIClassID"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="getUIClassID()">getUIClassID</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.lang.String.html">String</A> getUIClassID() </PRE>
<BLOCKQUOTE>
<DL>
<P>
Gets the class ID for the UI.
<P>
<DT> <B>Returns:</B>
<DD> the ID ("EditorPaneUI")
<DT><B>Overrides:</B>
<DD><A HREF="javax.swing.JComponent.html#getUIClassID()">getUIClassID</A> in class <A HREF="javax.swing.JComponent.html">JComponent</A>
</DL>
<P> <B>See Also:</B>
<A HREF="javax.swing.JComponent.html#getUIClassID">getUIClassID</A>, <A HREF="javax.swing.UIDefaults.html#getUI">getUI</A></BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="createDefaultEditorKit"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="createDefaultEditorKit()">createDefaultEditorKit</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="javax.swing.text.EditorKit.html">EditorKit</A> createDefaultEditorKit() </PRE>
<BLOCKQUOTE>
<DL>
<P>
Creates the default editor kit (PlainEditorKit) for when
the component is first created.
<P>
<DT> <B>Returns:</B>
<DD> the editor kit
</DL>
</BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="getEditorKit"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="getEditorKit()">getEditorKit</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 final <A HREF="javax.swing.text.EditorKit.html">EditorKit</A> getEditorKit() </PRE>
<BLOCKQUOTE>
<DL>
<P>
Fetches the currently installed kit for handling
content. createDefaultEditorKit() is called to set up a default
if necessary.
<P>
<DT> <B>Returns:</B>
<DD> the editor kit
</DL>
</BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="getContentType"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="getContentType()">getContentType</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 final <A HREF="java.lang.String.html">String</A> getContentType() </PRE>
<BLOCKQUOTE>
<DL>
<P>
Gets the type of content that this editor
is currently set to deal with. This is
defined to be the type associated with the
currently installed EditorKit.
<P>
<DT> <B>Returns:</B>
<DD> the content type, null if no editor kit set
</DL>
</BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="setContentType"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="setContentType(java.lang.String)">setContentType</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 final void setContentType(<A HREF="java.lang.String.html">String</A> type) </PRE>
<BLOCKQUOTE>
<DL>
<P>
Sets the type of content that this editor
handles. This calls <code>getEditorKitForContentType</code>,
and then <code>setEditorKit</code> if an editor kit can
be successfully located. This is mostly convenience method
that can be used as an alternative to calling
<code>setEditorKit</code> directly.
<p>
If there is a charset definition specified as a parameter
of the content type specification, it will be used when
loading input streams using the associated EditorKit.
For example if the type is specified as
<code>text/html; charset=EUC-JP</code> the content
will be loaded using the EditorKit registered for
<code>text/html</code> and the Reader provided to
the EditorKit to load unicode into the document will
use the <code>EUC-JP</code> charset for translating
to unicode.
<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>the non-null mime type for the content editing
support.</TD></TR>
</TABLE><P>
</DL>
<P> <B>See Also:</B>
<A HREF="#getContentType">getContentType</A></BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="setEditorKit"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="setEditorKit(javax.swing.text.EditorKit)">setEditorKit</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 setEditorKit(<A HREF="javax.swing.text.EditorKit.html">EditorKit</A> kit) </PRE>
<BLOCKQUOTE>
<DL>
<P>
Sets the currently installed kit for handling
content. This is the bound property that
establishes the content type of the editor.
Any old kit is first deinstalled, then if kit is non-null,
the new kit is installed, and a default document created for it.
A PropertyChange event ("editorKit") is always fired when
setEditorKit() is called.
<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> kit</I></TD> <TD>the desired editor behavior.</TD></TR>
</TABLE><P>
</DL>
<P> <B>See Also:</B>
<A HREF="#getEditorKit">getEditorKit</A></BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="getEditorKitForContentType"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="getEditorKitForContentType(java.lang.String)">getEditorKitForContentType</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="javax.swing.text.EditorKit.html">EditorKit</A> getEditorKitForContentType(<A HREF="java.lang.String.html">String</A> type) </PRE>
<BLOCKQUOTE>
<DL>
<P>
Fetches the editor kit to use for the given type
of content. This is called when a type is requested
that doesn't match the currently installed type.
If the component doesn't have an EditorKit registered
for the given type, it will try to create an
EditorKit from the default EditorKit registry.
If that fails, a PlainEditorKit is used on the
assumption that all text documents can be represented
as plain text.
<p>
This method can be reimplemented to use some
other kind of type registry. This can
be reimplemented to use the Java Activation
Framework for example.
<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>the non-null content type</TD></TR>
</TABLE><P>
<DT> <B>Returns:</B>
<DD> the editor kit
</DL>
</BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="setEditorKitForContentType"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="setEditorKitForContentType(java.lang.String, javax.swing.text.EditorKit)">setEditorKitForContentType</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 setEditorKitForContentType(<A HREF="java.lang.String.html">String</A> type,
<A HREF="javax.swing.text.EditorKit.html">EditorKit</A> k) </PRE>
<BLOCKQUOTE>
<DL>
<P>
Directly set the editor kit to use for the given type. A
look-and-feel implementation might use this in conjunction
with createEditorKitForContentType to install handlers for
content types with a look-and-feel bias.
<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>the non-null content type</TD></TR>
<TR VALIGN=TOP> <TD><I> k</I></TD> <TD>the editor kit to be set</TD></TR>
</TABLE><P>
</DL>
</BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="replaceSelection"><FONT COLOR="#FF0000">·</FONT></A>
<A NAME="replaceSelection(java.lang.String)">replaceSelection</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 replaceSelection(<A HREF="java.lang.String.html">String</A> content) </PRE>
<BLOCKQUOTE>
<DL>
<P>
Replaces the currently selected content with new content
represented by the given string. If there is no selection
this amounts to an insert of the given text. If there
is no replacement text this amounts to a removal of the
current selection. The replacement text will have the
attributes currently defined for input. If the document is not
editable, beep and return. Then if the document is null, do nothing.
If the content to insert is null or empty, ignore it.
<p>
This method is thread safe, although most Swing methods
are not. Please see
<A HREF="http://java.sun.com/products/jfc/swingdoc-archive/threads.html">Threads
and Swing</A> for more information.
<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> content</I></TD> <TD>the content to replace the selection with</TD></TR>
</TABLE><P>
<DT><B>Overrides:</B>
<DD><A HREF="javax.swing.text.JTextComponent.html#replaceSelection(java.lang.String)">replaceSelection</A> in class <A HREF="javax.swing.text.JTextComponent.html">JTextComponent</A>
</DL>
</BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="createEditorKitForContentType"><FONT COLOR="#00DD00">·</FONT></A>
<A NAME="createEditorKitForContentType(java.lang.String)">createEditorKitForContentType</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 static <A HREF="javax.swing.text.EditorKit.html">EditorKit</A> createEditorKitForContentType(<A HREF="java.lang.String.html">String</A> type) </PRE>
<BLOCKQUOTE>
<DL>
<P>
Create a handler for the given type from the default registry
of editor kits. The registry is created if necessary. It the
registered class has not yet been loaded, an attempt
is made to dynamically load the prototype of the kit for the
given type. If the type was registered with a ClassLoader,
that ClassLoader will be used to load the prototype. If there
was no registered ClassLoader, Class.forName will be used to
load the prototype.
<p>
Once a prototype EditorKit instance is successfully located,
it is cloned and the clone is returned.
<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>the content type</TD></TR>
</TABLE><P>
<DT> <B>Returns:</B>
<DD> the editor kit, or null if one cannot be created
</DL>
</BLOCKQUOTE> <BR>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=1 BORDER=0> <TR> <TD WIDTH=80%>
<BR><H3><A NAME="registerEditorKitForContentType"><FONT COLOR="#00DD00">·</FONT></A>
<A NAME="registerEditorKitForContentType(java.lang.String, java.lang.String)">registerEditorKitForContentType</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 static void registerEditorKitForContentType(<A HREF="java.lang.String.html">String</A> type,
<A HREF="java.lang.String.html">String</A> classname) </PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -