|
I eat cake for breakfast.
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 
|
First of all, use a switch-case statement to replace all those ifs:
switch (mode)
{
case 1:
g.drawLine( X1, Y1, X2, Y2 );
break;
case 2:
g.drawLine( LX1, LY1, LX2, LY2 );
break;
case 3:
g.fillRect( Math.min(X1,X2), Math.min(Y1,Y2), Math.abs(X1-X2),Math.abs(Y1-Y2));
break;
case 4:
g.fillOval( Math.min(X1,X2), Math.min(Y1,Y2), Math.abs(X1-X2),Math.abs(Y1-Y2));
break;
case 5:
g.drawRect( Math.min(X1,X2), Math.min(Y1,Y2), Math.abs(X1-X2),Math.abs(Y1-Y2));
break;
case 6:
g.drawOval( Math.min(X1,X2), Math.min(Y1,Y2), Math.abs(X1-X2),Math.abs(Y1-Y2));
}
repaint(); Is this code in a loop?
|