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); } }