Section 12.6 Text Fields and an Introduction to Event Handling with Nested Classes

• GUIs are event driven—when the user interacts with a GUI component, events (p. 485) drive the program to perform tasks.

• An event handler (p. 485) performs a task in response to an event.

• Class JTextField (p. 485) extends JTextComponent (p. 485) of package javax.swing.text, which provides common text-based component features. Class JPasswordField (p. 485) extends JTextField and adds several methods that are specific to processing passwords.

• A JPasswordField (p. 485) shows that characters are being typed as the user enters them, but hides the actual characters with echo characters (p. 485).

• A component receives the focus (p. 486) when the user clicks the ...

Get Java™ How To Program (Early Objects), Tenth 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.