AntiAliasing, stroke width and dashed strokes
class DrawingPanel extends JPanel{
float[] dash1 = { 10f, 10f};
BasicStroke bs1 = new BasicStroke(3, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1.0f, dash1, 0);
DrawingPanel(){
this.setBackground(new Color(0,0,0,20));
this.setPreferredSize(new Dimension(panW, panH));
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setStroke(new BasicStroke(3));
g2.drawLine(20, 40, 250, 40);
g2.setStroke(bs1);
g2.drawLine(20, 80, 250, 80);