public void paintComponent(Graphics g) { super.paintComponent(g); this.setBackground(Color.WHITE); Graphics2D g2d = (Graphics2D) g; RenderingHints rh = new RenderingHints( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2d.setRenderingHints(rh); for (int i = 0; i < strokes.size(); i++) { Stroke currentStroke = strokes.get(i); g2d.setPaint(currentStroke.getColor()); g2d.setStroke(new BasicStroke(currentStroke.getThickness())); ArrayList<Point2D> currentStrokePoints = currentStroke.getPoints(); for (int j = 1; j < currentStrokePoints.size(); j++) { g2d.drawLine( (int) (currentStrokePoints.get(j - 1).getX() * this.getSize().getWidth()), (int) (currentStrokePoints.get(j - 1).getY() * this.getSize().getHeight()), (int) (currentStrokePoints.get(j).getX() * this.getSize().getWidth()), (int) (currentStrokePoints.get(j).getY() * this.getSize().getHeight())); } } }