import java.awt.*; public class one { int x, y; one(startx, starty) { x = startx, y = starty; } public void paint(Graphics g) { g.drawLine(x,y,10,10); } public class two extends java.applet.Applet { one o; three t; init() { o = new one(100,200); t = new three(300,400); } public void paint(Graphics g) { o.paint(g); t.paint(g); } } |
public class three { int a,b; three(int newa, int newb) { a = newa; b = newb; } public void paint(Grapics g) { g.drawLine(a+100, b+100, 10,10); g.drawOval(a,b,100,100): g.drawString("Beach Boys", a/2, b/2); } } |