java.awt.TextComponent

TextField and TextArea both extend the TextComponent class. TextComponent, as a matter of fact, exists solely to provide fundamental text editing capabilities for TextArea and TextField.

As evidenced by the class diagram in Figure 14-1, TextComponent provides the following functionality:

Figure 14-1. TextComponent Class Diagram. TextComponent maintains text, selection range, and editability of the component. TextComponent cannot be instantiated by classes outside the java.awt package.

  • Get and set text

  • Get and set selected text

  • Get and set editable mode

  • Position the insertion caret[2]

    [2] Since caret manipulation is handled by ...

Get Graphic Java™ 1.2, Volume I: AWT, Third 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.