A good answer might be:

Because you say exactly where the text will go:

drawString( String, xLocation, yLocation )
You decide this, not the layout manager. Because this drawing is not controlled by the layout manager, the GUI will get messed up.

Listener for TextField

A TextField is a AWT component, so there must be a listener object to connect it to the rest of the program. After the user has entered some text into the field (and possibly corrected it) the user can hit the enter key. This generates an ActionEvent just as did clicking on a button.

Now the program will need to get the text the user has typed and do something with it. To get the text a user has typed into a TextField use the String getText() method. To put text into a TextField use the setText( String stuff) method.

QUESTION 7:

What type of listener is needed for an ActionEvent?

Click Here after you have answered the question