
9.24 Graphics Using AWT Controls
LineNos. 28 and 29: show how we can modify attributes such as colour and font.
Line No. 31: shows the drawstring methods, the prototype for which is
void drawString(String str, int x, int y),
where x and y are the starting co-ordinates of the string.
Similarly drawRect(int x, int y, int width,
int height)
in Line No. 32 draws a rectangle staring at x,
y and with width 100 and height 50. Fillrect in Line No. 34 is
similar to drawRect, the only difference being that fillRect
fills the rectangle with the specified colour.
At the end of chapter, we have provided worked example to enhance your learning experi- ...