Java g.drawString

Java AWT Drawing Strings Frame

Graphics class allows us to draw strings on the frame with its method drawString(). Following is the signature. void drawString(String str1, int x, int y): x and y are the coordinates where the string str1 is to be drawn on the frame. Following program illustrates.

setSize(300, 350); To draw…