View Single Post
Old May 6th, 2005, 8:32 AM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
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?
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote