(Graphics g)
| 442 | |
| 443 | drawLayer = new JPanel() { |
| 444 | @Override |
| 445 | public void paintComponent(Graphics g) { |
| 446 | super.paintComponent(g); // takes care of the background clearing |
| 447 | g.setColor(Color.red); |
| 448 | for (int i = 0, n = points.size(); i < n; i++) { |
| 449 | Point p = points.get(i); |
| 450 | g.drawLine(p.x - 5, p.y, p.x + 5, p.y); |
| 451 | g.drawLine(p.x, p.y - 5, p.x, p.y + 5); |
| 452 | } |
| 453 | } |
| 454 | }; |
| 455 | drawLayer.setBounds(0, 0, dim.width, dim.height); |
| 456 | drawLayer.setOpaque(false); |