예제 #1
0
 public void paintComponent(Graphics g) {
   if (position == null) return;
   int x = (int) position.getX();
   int y = (int) position.getY();
   if (parent.inFirstPath(this)) {
     g.setColor(Color.yellow);
     g.fillOval(x - RADIUS, y - RADIUS, 2 * RADIUS, 2 * RADIUS);
   } else if (parent.inQueue(this)) {
     g.setColor(Color.orange);
     g.fillOval(x - RADIUS, y - RADIUS, 2 * RADIUS, 2 * RADIUS);
   }
   g.setColor(getColor());
   g.drawOval(x - RADIUS, y - RADIUS, 2 * RADIUS, 2 * RADIUS);
   if (parent.isGoalNode(this)) g.setColor(Color.green);
   else if (parent.isStartNode(this)) g.setColor(Color.blue);
   g.drawString(toString(), x, y);
   if (!parent.getHideHeur()) g.drawString(model.getHeuristic() + "", x + RADIUS, y + RADIUS);
 }
예제 #2
0
 void setHeuristic(int h) {
   model.setHeuristic(h);
 }
예제 #3
0
 void setName(String s) {
   model.setName(s);
 }
예제 #4
0
 public String toString() {
   return model.toString();
 }