src/share/classes/java/awt/TextComponent.java

Print this page


   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


  90      * @see #setSelectionStart(int)
  91      */
  92     int selectionStart;
  93 
  94     /**
  95      * The selection refers to the selected text, and the
  96      * <code>selectionEnd</code>
  97      * is the end position of the selected text.
  98      *
  99      * @serial
 100      * @see #getSelectionEnd()
 101      * @see #setSelectionEnd(int)
 102      */
 103     int selectionEnd;
 104 
 105     // A flag used to tell whether the background has been set by
 106     // developer code (as opposed to AWT code).  Used to determine
 107     // the background color of non-editable TextComponents.
 108     boolean backgroundSetByClientCode = false;
 109 



 110     transient protected TextListener textListener;
 111 
 112     /*
 113      * JDK 1.1 serialVersionUID
 114      */
 115     private static final long serialVersionUID = -2214773872412987419L;
 116 
 117     /**
 118      * Constructs a new text component initialized with the
 119      * specified text. Sets the value of the cursor to
 120      * <code>Cursor.TEXT_CURSOR</code>.
 121      * @param      text       the text to be displayed; if
 122      *             <code>text</code> is <code>null</code>, the empty
 123      *             string <code>""</code> will be displayed
 124      * @exception  HeadlessException if
 125      *             <code>GraphicsEnvironment.isHeadless</code>
 126      *             returns true
 127      * @see        java.awt.GraphicsEnvironment#isHeadless
 128      * @see        java.awt.Cursor
 129      */


   1 /*
   2  * Copyright (c) 1995, 2014, 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


  90      * @see #setSelectionStart(int)
  91      */
  92     int selectionStart;
  93 
  94     /**
  95      * The selection refers to the selected text, and the
  96      * <code>selectionEnd</code>
  97      * is the end position of the selected text.
  98      *
  99      * @serial
 100      * @see #getSelectionEnd()
 101      * @see #setSelectionEnd(int)
 102      */
 103     int selectionEnd;
 104 
 105     // A flag used to tell whether the background has been set by
 106     // developer code (as opposed to AWT code).  Used to determine
 107     // the background color of non-editable TextComponents.
 108     boolean backgroundSetByClientCode = false;
 109 
 110     /**
 111      * A list of listeners that will receive events from this object.
 112      */
 113     transient protected TextListener textListener;
 114 
 115     /*
 116      * JDK 1.1 serialVersionUID
 117      */
 118     private static final long serialVersionUID = -2214773872412987419L;
 119 
 120     /**
 121      * Constructs a new text component initialized with the
 122      * specified text. Sets the value of the cursor to
 123      * <code>Cursor.TEXT_CURSOR</code>.
 124      * @param      text       the text to be displayed; if
 125      *             <code>text</code> is <code>null</code>, the empty
 126      *             string <code>""</code> will be displayed
 127      * @exception  HeadlessException if
 128      *             <code>GraphicsEnvironment.isHeadless</code>
 129      *             returns true
 130      * @see        java.awt.GraphicsEnvironment#isHeadless
 131      * @see        java.awt.Cursor
 132      */