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.
You have reached the end of the chapter. If you are in the right Frame of mind, you may wish to review the following:
setSize()
method of JFrame
setDefaultCloseOperation()
method of JFrame
JFrame
class.
paint()
method.
drawString()
method.
The next chapter will discuss how to add a listener to the Frame.