O'Reilly logo

Graphic Java™ 1.2, Volume I: AWT, Third Edition by David M. Geary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

java.awt.TextField

Ok, so we know that TextField inherits all of the functionality provided by its superclass, TextComponent. A TextField, as a result, can manage selection, editable mode, and caret positioning. You can also add text listeners to a textfield and watch the text change in the field. So, let's take a look at the additional functionality TextField provides for editing its one line of text. First, take a look at the four constructors provided by the TextField class.

  1. TextField()

  2. TextField(String text)

  3. TextField(int columns)

  4. TextField(String text, int columns)

If someone were to put a gun to your head and shout “quick! what's the columns argument for, and you'd better be right!” we're pretty confident that you could calmly reel off the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required