Here is the method I wrote, it gives an error when I call the method that the object g
is null and break. Please help me fix it, thank you. Base on my school, I must use Applet.
public void drawing(Graphics g,int a,int b,int c){ //method
double d,e,f,x,y,m;
d = (double) a;
e = (double) b;
f = (double) c;
if (e>f){
m=e;
e=f;
f=m;
}
I have try to initialize the object g... but I can't really do that..
ex=(e*e-f*f+d*d)/2/d;
//calculate the point required
ey=(Math.pow((d+e+f)*(d+e-f)*(d-e+f)*(e+f-d),0.5))/2/d;
//drawing the line
g.drawLine(0,0,(int) ex,(int) ey); //this is the main problem
}
I have try to initialize the object g... but I can't really do that..