private void updateRouteLocation(int direction) {
    if (direction == FORWARD) {
      _routeIndex++;
    }
    if (direction == BACK) {
      _routeIndex--;
    }
    // Confirm that index is in range
    if (_routeIndex > _routeList.size() - 1) {
      _routeIndex = _routeList.size() - 1;
    }
    if (_routeIndex < 0) {
      _routeIndex = 0;
    }

    if (_rl != null) {
      _rl.removePropertyChangeListener(this);
    }
    if (_routeList.size() > 0) {
      _rl = _routeList.get(_routeIndex);
    }
    if (_rl != null) {
      _rl.addPropertyChangeListener(this);
      loadSpinners(_rl);
      routeLocationName.setText(_rl.getName());
    }
    setTrainIconNameAndColor();
  }
 private void updateTrainIconCoordinates() {
   if (_rl != null) {
     _rl.removePropertyChangeListener(this);
     _rl.setTrainIconX((Integer) spinTrainIconX.getValue());
     _rl.setTrainIconY((Integer) spinTrainIconY.getValue());
     _rl.addPropertyChangeListener(this);
   }
 }
 public void dispose() {
   removeIcons();
   _route.removePropertyChangeListener(this);
   if (_rl != null) {
     _rl.removePropertyChangeListener(this);
   }
   super.dispose();
 }
 private void setTrainIconNameAndColor() {
   if (_tIon == null) {
     return;
   }
   _tIon.setText(_rl.getName());
   // set color based on train direction at current location
   if (_rl.getTrainDirection() == RouteLocation.NORTH) {
     _tIon.setLocoColor(Setup.getTrainIconColorNorth());
   }
   if (_rl.getTrainDirection() == RouteLocation.SOUTH) {
     _tIon.setLocoColor(Setup.getTrainIconColorSouth());
   }
   if (_rl.getTrainDirection() == RouteLocation.EAST) {
     _tIon.setLocoColor(Setup.getTrainIconColorEast());
   }
   if (_rl.getTrainDirection() == RouteLocation.WEST) {
     _tIon.setLocoColor(Setup.getTrainIconColorWest());
   }
 }
 // place test markers on panel
 private void placeTestIcons() {
   Editor editor = PanelMenu.instance().getEditorByName(Setup.getPanelName());
   if (editor == null) {
     JOptionPane.showMessageDialog(
         this,
         MessageFormat.format(Bundle.getMessage("LoadPanel"), new Object[] {Setup.getPanelName()}),
         Bundle.getMessage("PanelNotFound"),
         JOptionPane.ERROR_MESSAGE);
   } else {
     if (_tIon != null) {
       _tIon.remove();
     }
     // icon
     _tIon = editor.addTrainIcon(_rl.getName());
     _tIon.getTooltip().setText(_route.getName());
     _tIon.getTooltip().setBackgroundColor(Color.white);
     _tIon.setLocation(_rl.getTrainIconX(), _rl.getTrainIconY());
     setTrainIconNameAndColor();
     addIconListener(_tIon);
   }
 }
 private void loadSpinners(RouteLocation rl) {
   log.debug("Load spinners route location {}", rl.getName());
   spinTrainIconX.setValue(rl.getTrainIconX());
   spinTrainIconY.setValue(rl.getTrainIconY());
 }