1 Reply Latest reply: Oct 17, 2012 6:00 AM by Tolls RSS

    Rectangle  within and applet

    968909
      In writing a simple program for rectangle I am getting an error.

      The method setDimensions(int, int) is undefined for the type Rectangle

      Here is my program:

      import java.awt.*;
      import java.applet.*;

      public class RectangleTest extends Applet{

           Rectangle r = new Rectangle();
           
           public void init(){
                
                r.setDimensions(3,4);
                
           }
           
           public void paint (Graphics g){
                g.drawString("The area of rectangle r is " + r.area(),20,20);
           }
      }

      Thoughts?

      Please and Thank you - btw - I am new to java