Example #1
0
  public void paint(Graphics g) {
    ArrayList<Edge> SeenEdges = new ArrayList<Edge>();
    Graphics2D g2 = (Graphics2D) g;
    super.paintComponents(g2);
    double maxX = 0;
    double maxY = 0;

    for (ArrayList<Edge> path : Data.pathArray) {
      for (Edge edge : path) {
        if (edge.getPointA().getX() > maxX) {
          maxX = edge.getPointA().getX();
        }
        if (edge.getPointB().getX() > maxX) {
          maxX = edge.getPointB().getX();
        }
        if (edge.getPointA().getY() > maxY) {
          maxY = edge.getPointA().getY();
        }
        if (edge.getPointB().getY() > maxY) {
          maxY = edge.getPointB().getY();
        }
      }
    }

    for (ArrayList<Edge> paths : Data.pathArray) {
      for (Edge edge : paths) {
        for (Edge seenEdge : SeenEdges) {
          if (edge.compare(seenEdge) || edge.revCompare(seenEdge)) {
            thickness = 4;
            break;
          } else {
            thickness = 2;
          }
        }
        SeenEdges.add(edge);

        g2.setStroke(new BasicStroke(thickness));
        Line2D lin =
            new Line2D.Float(
                (float) edge.getPointA().getX() * SCALEX + OFFSETX,
                (float) edge.getPointA().getY() * SCALEY + OFFSETY,
                (float) edge.getPointB().getX() * SCALEX + OFFSETX,
                (float) edge.getPointB().getY() * SCALEY + OFFSETY);
        g2.draw(lin);
      }
    }
  }
Example #2
0
 public void paint(Graphics g) {
   super.paintComponents(g);
   if (screenImage != null) g.drawImage(screenImage, -getX(), -getY(), null);
   if (fileImage != null) g.drawImage(fileImage, 0, 0, null);
 }
Example #3
0
 public void paintComponent(Graphics g) {
   super.paintComponents(g);
 }