1 /*
2 * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25 package java.awt;
26
27 import java.awt.peer.TextComponentPeer;
28 import java.awt.event.*;
29 import java.util.EventListener;
30 import java.io.ObjectOutputStream;
31 import java.io.ObjectInputStream;
32 import java.io.IOException;
33 import sun.awt.InputMethodSupport;
34 import java.text.BreakIterator;
35 import javax.swing.text.AttributeSet;
36 import javax.accessibility.*;
37 import java.awt.im.InputMethodRequests;
38 import javax.tools.annotation.GenerateNativeHeader;
39
40 /**
41 * The <code>TextComponent</code> class is the superclass of
42 * any component that allows the editing of some text.
43 * <p>
44 * A text component embodies a string of text. The
45 * <code>TextComponent</code> class defines a set of methods
46 * that determine whether or not this text is editable. If the
47 * component is editable, it defines another set of methods
48 * that supports a text insertion caret.
49 * <p>
50 * In addition, the class defines methods that are used
51 * to maintain a current <em>selection</em> from the text.
52 * The text selection, a substring of the component's text,
53 * is the target of editing operations. It is also referred
54 * to as the <em>selected text</em>.
55 *
56 * @author Sami Shaio
57 * @author Arthur van Hoff
58 * @since JDK1.0
59 */
60 /* No native methods here, but the constants are needed in the supporting JNI code */
61 @GenerateNativeHeader
62 public class TextComponent extends Component implements Accessible {
63
64 /**
65 * The value of the text.
66 * A <code>null</code> value is the same as "".
67 *
68 * @serial
69 * @see #setText(String)
70 * @see #getText()
71 */
72 String text;
73
74 /**
75 * A boolean indicating whether or not this
76 * <code>TextComponent</code> is editable.
77 * It will be <code>true</code> if the text component
78 * is editable and <code>false</code> if not.
79 *
80 * @serial
81 * @see #isEditable()
|
1 /*
2 * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25 package java.awt;
26
27 import java.awt.peer.TextComponentPeer;
28 import java.awt.event.*;
29 import java.util.EventListener;
30 import java.io.ObjectOutputStream;
31 import java.io.ObjectInputStream;
32 import java.io.IOException;
33 import sun.awt.InputMethodSupport;
34 import java.text.BreakIterator;
35 import javax.swing.text.AttributeSet;
36 import javax.accessibility.*;
37 import java.awt.im.InputMethodRequests;
38
39 /**
40 * The <code>TextComponent</code> class is the superclass of
41 * any component that allows the editing of some text.
42 * <p>
43 * A text component embodies a string of text. The
44 * <code>TextComponent</code> class defines a set of methods
45 * that determine whether or not this text is editable. If the
46 * component is editable, it defines another set of methods
47 * that supports a text insertion caret.
48 * <p>
49 * In addition, the class defines methods that are used
50 * to maintain a current <em>selection</em> from the text.
51 * The text selection, a substring of the component's text,
52 * is the target of editing operations. It is also referred
53 * to as the <em>selected text</em>.
54 *
55 * @author Sami Shaio
56 * @author Arthur van Hoff
57 * @since JDK1.0
58 */
59 public class TextComponent extends Component implements Accessible {
60
61 /**
62 * The value of the text.
63 * A <code>null</code> value is the same as "".
64 *
65 * @serial
66 * @see #setText(String)
67 * @see #getText()
68 */
69 String text;
70
71 /**
72 * A boolean indicating whether or not this
73 * <code>TextComponent</code> is editable.
74 * It will be <code>true</code> if the text component
75 * is editable and <code>false</code> if not.
76 *
77 * @serial
78 * @see #isEditable()
|