Text Component

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 TextField Methods

This is second program on TextField, first being User Name Password Validation (applet version is also available). The methods like setColumns(), setText() and setFont(), getColumns() and getText() are used to set and get the properties. Example on using Java TextField Methods import java.awt.*; public class TextFieldProperties extends Frame { TextField tf1, tf2, tf3; public TextFieldProperties() …

Java TextField Methods 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 »