Canvas problem
hello everybody i am new here and my problem is that when i am trying to draw a polygon using Canvas class and Jframe class and stuff i get the Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException problem my code is this:
Anyone can help please thx
class buildSweep extends Canvas {
String [] temp;
/**GUI variables declared*/
Canvas can = new Canvas();
Container cot = new Container();
Graphics2D neo ;
JFrame frame = new JFrame();
buildSweep(String s [][]){
temp = s;
draw(temp);
}
public void draw(String temp [][] ){
can.setSize(600,600);
int x1 = Integer.parseInt(temp[1][0]);
int y1 = Integer.parseInt(temp[1][1]);
int x2 = Integer.parseInt(temp[2][0]);
int y2 = Integer.parseInt(temp[2][1]);
int x3 = Integer.parseInt(temp[3][0]);
int y3 = Integer.parseInt(temp[3][1]);
int x4 =Integer.parseInt(temp[4][0]);
int y4=Integer.parseInt(temp[4][1]);
int x5=Integer.parseInt(temp[5][0]);
int y5=Integer.parseInt(temp[5][1]);
int x6=Integer.parseInt(temp[6][0]);
int y6=Integer.parseInt(temp[6][1]);
int x7=Integer.parseInt(temp[7][0]);
int y7=Integer.parseInt(temp[7][1]);
int x8=Integer.parseInt(temp[8][0]);
int y8=Integer.parseInt(temp[8][1]);
int [] totalx = {x1,x2,x3,x4,x5,x6,x7,x8};
int [] totaly = {y1,y2,y3,y4,y5,y6,y7,y8};
neo.drawPolygon(totalx,totaly,16);
can.paint(neo);
cot.add(can);
frame.setContentPane(cot);
frame.pack();
frame.show();
}
}

