Class TextFieldTest

Class TextFieldTest (Fig. I.2) contains the main method that executes this app and displays an object of class TextFieldFrame. When you execute the app, even the uneditable JTextField (textField3) can generate an ActionEvent. To test this, click the text field to give it the focus, then press Enter. Also, the actual text of the password is displayed when you press Enter in the JPasswordField. Of course, you would normally not display the password!

 1   // Fig. I.2: TextFieldTest.java 2   // Testing TextFieldFrame. 3   import javax.swing.JFrame; 4  5   public class TextFieldTest 6   { 7      public static void main( String[] args ) 8      { 9         TextFieldFrame textFieldFrame = new TextFieldFrame(); ...

Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.