Back to string properties

-Listeners were not working with getting values from existing properties

#refactor #story[15]
main
Erika Savell 9 years ago
parent 7e2804215b
commit 288324ace6

@ -20,6 +20,7 @@ public class BoatInRace extends Boat {
private long timeFinished; private long timeFinished;
private Color colour; private Color colour;
private boolean finished = false; private boolean finished = false;
private StringProperty currentLegName;
/** /**
* Constructor method. * Constructor method.
@ -30,6 +31,7 @@ public class BoatInRace extends Boat {
public BoatInRace(String name, double velocity, Color colour, String abbrev) { public BoatInRace(String name, double velocity, Color colour, String abbrev) {
super(name, velocity, abbrev); super(name, velocity, abbrev);
setColour(colour); setColour(colour);
currentLegName = new SimpleStringProperty("");
} }
/** /**
@ -90,14 +92,10 @@ public class BoatInRace extends Boat {
*/ */
public void setCurrentLeg(Leg currentLeg) { public void setCurrentLeg(Leg currentLeg) {
this.currentLeg = currentLeg; this.currentLeg = currentLeg;
this.currentLegName.setValue(currentLeg.getName());
} }
public StringProperty getCurrentLegName(){ public StringProperty getCurrentLegName(){
StringProperty currentLegName = new SimpleStringProperty("");
if (currentLeg != null) {
currentLegName.setValue(currentLeg.getName());
}
return currentLegName; return currentLegName;
} }

Loading…
Cancel
Save