示例#1
0
 /*
  * This resets the map whenever reset is selected.
  */
 public void reset() {
   mapPanel.clearList();
   pane.getHorizontalScrollBar().setValue(0);
   pane.getVerticalScrollBar().setValue(0);
   list1.setSelectedIndex(0);
   list2.setSelectedIndex(0);
   mapPanel.repaint();
 }
示例#2
0
  /*
   * When the 'find path' button is selected, this handles actually finding and
   * displaying the path for the two given buildings.
   */
  public void findPath() {
    // Get the starting location and destination from the combo boxes
    String start = String.valueOf(list1.getSelectedItem());
    String end = String.valueOf(list2.getSelectedItem());

    // Before new path is displayed, the old path must be removed
    mapPanel.clearList();

    // This handles calling the appropriate methods which will get the right
    // data and draw the paths on the map
    mapPanel.setLocations(start, end);
    mapPanel.getList();
    setHorizBar(mapPanel.horizontalPos());
    setVertBar(mapPanel.verticalPos());

    // Must repaint for the paths to show up immediately!!
    mapPanel.repaint();
  }