📄 jtextarea.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:39:32 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class JTextArea</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/JTextArea.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/JTable.AccessibleJTable.AccessibleJTableModelChange.html"><B>PREV CLASS</B></A> <A HREF="../../javax/swing/JTextArea.AccessibleJTextArea.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="JTextArea.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> | <A HREF="#fields_inherited_from_class_javax.swing.text.JTextComponent">FIELD</A> | <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</FONT><BR>Class JTextArea</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A> | +--<A HREF="../../java/awt/Component.html">java.awt.Component</A> | +--<A HREF="../../java/awt/Container.html">java.awt.Container</A> | +--<A HREF="../../javax/swing/JComponent.html">javax.swing.JComponent</A> | +--<A HREF="../../javax/swing/text/JTextComponent.html">javax.swing.text.JTextComponent</A> | +--<B>javax.swing.JTextArea</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../javax/accessibility/Accessible.html">Accessible</A>, <A HREF="../../java/awt/image/ImageObserver.html">ImageObserver</A>, <A HREF="../../java/awt/MenuContainer.html">MenuContainer</A>, <A HREF="../../javax/swing/Scrollable.html">Scrollable</A>, <A HREF="../../java/io/Serializable.html">Serializable</A></DD></DL><HR><DL><DT>public class <B>JTextArea</B><DT>extends <A HREF="../../javax/swing/text/JTextComponent.html">JTextComponent</A></DL><P>A TextArea is a multi-line area that displays plain text. It is intended to be a lightweight component that provides source compatibility with the java.awt.TextArea class where it can reasonably do so. You can find information and examples of using all the text components in <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/text.html">Using Text Components</a>, a section in <em>The Java Tutorial.</em> <p> This component has capabilities not found in the java.awt.TextArea class. The superclass should be consulted for additional capabilities. Alternative multi-line text classes with more capabilitites are JTextPane and JEditorPane. <p> The <code>java.awt.TextArea</code> internally handles scrolling. <code>JTextArea</code> is different in that it doesn't manage scrolling, but implements the swing <code>Scrollable</code> interface. This allows it to be placed inside a <code>JScrollPane</code> if scrolling behavior is desired, and used directly if scrolling is not desired. <p> The <code>java.awt.TextArea</code> has the ability to do line wrapping. This was controlled by the horizontal scrolling policy. Since scrolling is not done by <code>JTextArea</code> directly, backward compatibility must be provided another way. <code>JTextArea</code> has a bound property for line wrapping that controls whether or not it will wrap lines. By default, the line wrapping property is set to false (not wrapped). <p> <code>java.awt.TextArea</code> has two properties <em>rows</em> and <em>columns</em> that are used to determine the preferred size. <code>JTextArea</code> uses these properties to indicate the preferred size of the viewport when placed inside a JScrollPane to match the functionality provided by <code>java.awt.TextArea</code>. <code>JTextArea</code> has a preferred size of what is needed to display all of the text, so that it functions properly inside of a <code>JScrollPane</code>. If the value for the rows or columns is equal to zero, the preferred size along that axis is used for the viewport preferred size along the same axis. <p> The java.awt.TextArea could be monitored for changes by adding a TextListener for TextEvent's. In the JTextComponent based components, changes are broadcasted from the model via a DocumentEvent to DocumentListeners. The DocumentEvent gives the location of the change and the kind of change if desired. The code fragment might look something like: <pre><code> DocumentListener myListener = ??; JTextArea myArea = ??; myArea.getDocument().addDocumentListener(myListener); </code></pre> <p> For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions, see the <a href="doc-files/Key-Index.html#JTextArea">JTextArea</a> key assignments. <p> <strong>Warning:</strong> Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -