A
Adrian M. Hanslik
Hello there,
I've got a JPanel on which I draw GeneralPaths.
As it's a bit too complex sometimes,
I'd like to clean the JPanel on which I draw
before I draw a new GeneralPath...
The code below shows my current solution...
<CODE>
super.paintComponent(g);
((Graphics2D) g).scale(zoom, zoom);
g.setColor(Color.white);
g.clearRect(0, 0, 800, 600);
double dummy = width / (2 * Math.PI + Double.MIN_VALUE);
BasicStroke simple = new BasicStroke((float) (1 / dummy));
((Graphics2D) g).setStroke(simple);
((Graphics2D) g).setColor(new Color(128, 128, 128));
((Graphics2D) g).draw(grid);
((Graphics2D) g).draw(door);
((Graphics2D) g).setColor(Color.blue);
((Graphics2D) g).draw(path);
</CODE>
What's wrong with that?
I also tried fillRect instead of clearRect,
but it didn't worked, either.
Kindest regards
Adrian
I've got a JPanel on which I draw GeneralPaths.
As it's a bit too complex sometimes,
I'd like to clean the JPanel on which I draw
before I draw a new GeneralPath...
The code below shows my current solution...
<CODE>
super.paintComponent(g);
((Graphics2D) g).scale(zoom, zoom);
g.setColor(Color.white);
g.clearRect(0, 0, 800, 600);
double dummy = width / (2 * Math.PI + Double.MIN_VALUE);
BasicStroke simple = new BasicStroke((float) (1 / dummy));
((Graphics2D) g).setStroke(simple);
((Graphics2D) g).setColor(new Color(128, 128, 128));
((Graphics2D) g).draw(grid);
((Graphics2D) g).draw(door);
((Graphics2D) g).setColor(Color.blue);
((Graphics2D) g).draw(path);
</CODE>
What's wrong with that?
I also tried fillRect instead of clearRect,
but it didn't worked, either.
Kindest regards
Adrian