My problem is that I want to draw a dashed line in a panel, I\'m able to do it but it draw my border in dashed line as well, which is oh my god!
Can someone please e
You modified the graphics context by setting a stroke, and subsequent methods such as paintBorder() use the same context and thus inherit all modifications you made.
Solution: clone the context, use it for painting and dispose it afterwards.
Code:
// derive your own context
Graphics2D g2d = (Graphics2D) g.create();
// use context for painting
...
// when done: dispose your context
g2d.dispose();