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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.