Page 2 :
TextField:, The, , TextField class implements a single-line, , text-entry area, usually called an edit control., Text, , fields allow the user to enter strings and to, , edit the text using the arrow keys, cut and paste, keys, and mouse selections., TextField, , is a subclass of TextComponent.
Page 6 :
TextField:, TextField, , Methods, , (and its superclass TextComponent), , provides several methods that allow us to, utilize a text field., In, , order to obtain the string currently contained, , in the text field, we can use getText() & for, setting the text, we call setText( ).
Page 8 :
TextField:, The, , Methods, , user can select a portion of the text in a, , text field. Also, we can select a portion of text, under program control by using select()., In, , program we can obtain the currently selected, , text by calling the getSelectedText( ).
Page 10 :
TextField:, We, , Methods, , can control whether the contents of a text, , field may be modified by the user by calling, setEditable( )., We, , can determine editability by calling, , isEditable( ).
Page 11 :
TextField:, boolean, , Methods, , isEditable()- This method returns true, , if the text may be changed and false if not., void, , setEditable(boolean canEdit)- if canEdit, , is assigned to true, the text may be changed &, If it is assigned to false, the text cannot be, altered.
Page 12 :
TextField:, There, , Methods, , may be times when we will want the, , user to enter text that is not displayed, such as a, password., You, , can disable the echoing of the characters, , as they are typed by calling setEchoChar( ).
Page 13 :
TextField:, This, , Methods, , method specifies a single character that, , the TextField will display when characters are, entered (thus, the actual characters typed will, not be shown)., We, , can check a text field to see if it is in this, , mode with the echoCharIsSet( ) method.
Page 14 :
TextField:, We, , Methods, , can retrieve the echo character by calling, , the getEchoChar( ) method., boolean, , echoCharIsSet() – It returns true if, , echo character is assigned otherwise false., char, , getEchoChar()- It returns the character, , which is assigned as a echo character.
Page 15 :
TextField:, void, , Methods, , setEchoChar(char ch)-Here, ch specifies, , the character to be echoed.
Page 20 :
Handling, Since, , a TextField, , text fields perform their own editing, , functions, your program generally will not respond, to individual key events that occur within a text, field., However,, , you may want to respond when the user, , presses ENTER. When this occurs, an action event, is generated.
Page 23 :
TextArea:, Sometimes, , a single line of text input is not, , enough for a given task. To handle these, situations, the AWT includes a simple multiline, editor called TextArea.
Page 24 :
TextArea:, The, , user can type here as much as he wants., , When the text in the text area become larger, than the viewable area the scroll bar is, automatically appears which help us to scroll, the text up & down and right & left.
Page 25 :
, , TextArea: Constructors, , , , TextArea( )- This constructor creates new text area, with the empty string as text., , , , TextArea(int numLines, int numChars) – This, creates a new text area with the specified number of, numLines and numChars and the empty string as text., , , , TextArea(String str) – This creates a new text area, with the specified str.
Page 30 :
TextArea:, void, , Methods, , append(String str)- It appends the string, , specified by str to the end of the current text., void, , insert(String str, int index) -It inserts the, , string passed in str at the specified index.
Page 32 :
TextArea:, void, , Methods, , setColumns(int columns)-Sets the, , number of columns for this text area., void, , setRows(int rows)-Sets the number of, , rows for this text area.
Page 34 :
Handling, When, , a TextComponent, , the text in text component get changes, , the TextEvent is generated., To, , handle this event we have to implement the, , TextListener interface & textValueChanged(), method has to define., public void textValueChanged(TextEvent te)
Page 36 :
Handling, When, , a TextComponent, , the key typed in text component the, , KeyEvent is generated., To, , handle this event we have to implement the, , KeyListener interface & it’s keyPressed(),, keyReleased() & keyTyped() method has to, define.