Answer:

class MyFrame extends Frame
{
  public void paint ( Graphics g )
  {
    g.drawString("Hello", 0, 50);
  }

}
To be precise, you should adjust the starting coordinates based on the size of the characters in "Hello". Also, the size of the drawing area includes the borders and the top bar of the frame. To get "Hello" in the center of the remaining area you must account for those borders. All this can be done, but let's not.

End of the Chapter

You have reached the end of the chapter. If you are in the right Frame of mind, you may wish to review the following:

The next chapter will discuss how to add a listener to the Frame.

You have reached the end of the chapter.

go to previous page   go to home page