Performance's issue when drawing dashed line in Java
问题 Using the following code, I am able to draw a dashed line: public void foo(Graphics2D g2d, Shape shape) { Stroke stroke = BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10, new float[]{10}, 0); g2d.setStroke(stroke); g2d.draw(shape); } Once a shape is created, I want to be able to zoom on that shape (up to 20 000 time). The issue I have is that, when I zoom too much on the shape, the application start to lag and will eventually, if I continue to zoom, crash. With a plain line, I