📄 basictextui.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:41:03 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class BasicTextUI</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/BasicTextUI.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../javax/swing/plaf/basic/BasicTextPaneUI.html"><B>PREV CLASS</B></A> <A HREF="../../../../javax/swing/plaf/basic/BasicTextUI.BasicCaret.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="BasicTextUI.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: <A HREF="#inner_class_summary">INNER</A> | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.swing.plaf.basic</FONT><BR>Class BasicTextUI</H2><PRE><A HREF="../../../../java/lang/Object.html">java.lang.Object</A> | +--<A HREF="../../../../javax/swing/plaf/ComponentUI.html">javax.swing.plaf.ComponentUI</A> | +--<A HREF="../../../../javax/swing/plaf/TextUI.html">javax.swing.plaf.TextUI</A> | +--<B>javax.swing.plaf.basic.BasicTextUI</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../javax/swing/text/ViewFactory.html">ViewFactory</A></DD></DL><DL><DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../javax/swing/plaf/basic/BasicEditorPaneUI.html">BasicEditorPaneUI</A>, <A HREF="../../../../javax/swing/plaf/basic/BasicTextAreaUI.html">BasicTextAreaUI</A>, <A HREF="../../../../javax/swing/plaf/basic/BasicTextFieldUI.html">BasicTextFieldUI</A>, <A HREF="../../../../javax/swing/text/DefaultTextUI.html">DefaultTextUI</A></DD></DL><HR><DL><DT>public abstract class <B>BasicTextUI</B><DT>extends <A HREF="../../../../javax/swing/plaf/TextUI.html">TextUI</A><DT>implements <A HREF="../../../../javax/swing/text/ViewFactory.html">ViewFactory</A></DL><P><p> Basis of a text components look-and-feel. This provides the basic editor view and controller services that may be useful when creating a look-and-feel for an extension of JTextComponent. <p> Most state is held in the associated JTextComponent as bound properties, and the UI installs default values for the various properties. This default will install something for all of the properties. Typically, a LAF implementation will do more however. At a minimum, a LAF would generally install key bindings. <p> This class also provides some concurrency support if the Document associated with the JTextComponent is a subclass of AbstractDocument. Access to the View (or View hierarchy) is serialized between any thread mutating the model and the Swing event thread (which is expected to render, do model/view coordinate translation, etc). <em>Any access to the root view should first aquire a read-lock on the AbstractDocument and release that lock in a finally block.</em> <p> An important method to define is the <A HREF="../../../../javax/swing/plaf/basic/BasicTextUI.html#getPropertyPrefix()"><CODE>getPropertyPrefix()</CODE></A> method which is used as the basis of the keys used to fetch defaults from the UIManager. The string should reflect the type of TextUI (eg. TextField, TextArea, etc) without the particular LAF part of the name (eg Metal, Motif, etc). <p> To build a view of the model, one of the following strategies can be employed. <ol> <li> One strategy is to simply redefine the ViewFactory interface in the UI. By default, this UI itself acts as the factory for View implementations. This is useful for simple factories. To do this reimplement the <A HREF="../../../../javax/swing/plaf/basic/BasicTextUI.html#create(javax.swing.text.Element)"><CODE>create(javax.swing.text.Element)</CODE></A> method. <li> A common strategy for creating more complex types of documents is to have the EditorKit implementation return a factory. Since the EditorKit ties all of the pieces necessary to maintain a type of document, the factory is typically an important part of that and should be produced by the EditorKit implementation. <li> A less common way to create more complex types is to have the UI implementation create a. seperate object for the factory. To do this, the <CODE>#createViewFactory</CODE> method should be reimplemented to return some factory. </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><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>static class</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/swing/plaf/basic/BasicTextUI.BasicCaret.html">BasicTextUI.BasicCaret</A></B></CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static class</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/swing/plaf/basic/BasicTextUI.BasicHighlighter.html">BasicTextUI.BasicHighlighter</A></B></CODE><BR> </TD></TR></TABLE> <!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../../javax/swing/plaf/basic/BasicTextUI.html#BasicTextUI()">BasicTextUI</A></B>()</CODE><BR> Creates a new UI.</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../../javax/swing/text/View.html">View</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/swing/plaf/basic/BasicTextUI.html#create(javax.swing.text.Element)">create</A></B>(<A HREF="../../../../javax/swing/text/Element.html">Element</A> elem)</CODE><BR> Creates a view for an element.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../../javax/swing/text/View.html">View</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/swing/plaf/basic/BasicTextUI.html#create(javax.swing.text.Element, int, int)">create</A></B>(<A HREF="../../../../javax/swing/text/Element.html">Element</A> elem, int p0, int p1)</CODE><BR> Creates a view for an element.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected <A HREF="../../../../javax/swing/text/Caret.html">Caret</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/swing/plaf/basic/BasicTextUI.html#createCaret()">createCaret</A></B>()</CODE><BR> Creates the object to use for a caret.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected <A HREF="../../../../javax/swing/text/Highlighter.html">Highlighter</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/swing/plaf/basic/BasicTextUI.html#createHighlighter()">createHighlighter</A></B>()</CODE><BR> Creates the object to use for adding highlights.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected <A HREF="../../../../javax/swing/text/Keymap.html">Keymap</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/swing/plaf/basic/BasicTextUI.html#createKeymap()">createKeymap</A></B>()</CODE><BR> Creates the keymap to use for the text component, and installs any necessary bindings into it.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/swing/plaf/basic/BasicTextUI.html#damageRange(javax.swing.text.JTextComponent, int, int)">damageRange</A></B>(<A HREF="../../../../javax/swing/text/JTextComponent.html">JTextComponent</A> tc, int p0, int p1)</CODE><BR> Causes the portion of the view responsible for the given part of the model to be repainted.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/swing/plaf/basic/BasicTextUI.html#damageRange(javax.swing.text.JTextComponent, int, int, javax.swing.text.Position.Bias, javax.swing.text.Position.Bias)">damageRange</A></B>(<A HREF="../../../../javax/swing/text/JTextComponent.html">JTextComponent</A> t, int p0, int p1, <A HREF="../../../../javax/swing/text/Position.Bias.html">Position.Bias</A> p0Bias, <A HREF="../../../../javax/swing/text/Position.Bias.html">Position.Bias</A> p1Bias)</CODE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -