hi im having this error i dont now where is the mistake can you halpe me?
this is the exception:
java.lang.NullPointerException
at shape.shape.<init>(shape.java:14)
at shape.rectangle.<init>(rectangle.java:17)
at shape.listOfSHAPES.init(listOfSHAPES.java:73)
at sun.applet.AppletPanel.run(AppletPanel.java:424)
at java.lang.Thread.run(Thread.java:619)
these are part of my code were it show the error
list of shapes class:
else if(shape.charAt(0)=='R'||shape.charAt(0)=='r')
{
int width=Math.abs(p2.getx()-p1.getx());
int hight=Math.abs(p2.getY()-p2.getY());
rectangle rect1= new rectangle(p1,width,hight);
Shapes.add(rect1);
}
rectangle class class:
rectangle(point p,int width,int hight)
{
super(p);
this.width=width;
this.hight=hight;
}
shape class:
shape(point p3)
{
p.setX(p3.getx());
p.setY(p3.getY());
}
and incase the point class:
public point(int x,int y)throws ExceptionInInitializerError
{
if(x<0||x>200)
{
throw new ExceptionInInitializerError("point "+ x +"is not in the range");
}
else
this.x=x;
if(y<0||y>200)
{
throw new ExceptionInInitializerError("point "+ y +"is not in the range");
}
else
this.y=y;
}
public point(point p2)
{
x=p2.getx();
y=p2.getY();
}
thanks very much for any attempt