setText

TextField Applet Adding Two Numbers

After validating user name and password using TextField in an application (application extends frame), let us rewrite the same program using applets but with a different functionality. We take two numbers from the user and display the sum of two numbers. The following program comes with 3 text fields. In two text fields, user enters …

TextField Applet Adding Two Numbers Read More »

Java TextArea Multiple Lines Text

Java TextArea overcomes the limitation of TextField and is used to display or take input in multiple lines of text. Following list illustrates the limitations. Differences between TextField and TextArea TextField displays only one line of text of any length. TextArea displays multiple lines of text of any length. TextField generates ActionEvent handled by ActionListener …

Java TextArea Multiple Lines Text Read More »

TextField User Name Password Validation

After Button, the most used AWT component is TextField. TextField is useful to take input from the user and also to display output to the user by the programmer. User can write and edit the text in the TextField. Programmatically, the TextField can be made non-editable. Pressing Enter key generates ActionEvent and can be handled …

TextField User Name Password Validation Read More »