1 package bookExamples.ch26Graphics.draw2d; 2 3 4 import java.awt.*; 5 6 class String2d extends Shape { 7 int x1 = 0; 8 int y1 = 0; 9 String str; 10 11 String2d(int _x1, int _y1, String _str) { 12 x1 = _x1; 13 y1 = _y1; 14 str = _str; 15 } 16 17 public void paint(Graphics g) { 18 g.drawString(str, x1, y1); 19 } 20 } 21