Implemented the Time showing on Grid

- Added Label to scene
- Added Timezone formatting
#story[28] #pair[fwy13,hba56]
main
Fan-Wu Yang 9 years ago
parent 71f0085268
commit 7790322e04

@ -18,8 +18,14 @@ import seng302.RaceXMLReader;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.TimeZone;
/** /**
* Created by fwy13 on 15/03/2017. * Created by fwy13 on 15/03/2017.
@ -42,6 +48,8 @@ public class RaceController extends Controller {
Label timer; Label timer;
@FXML @FXML
Label FPS; Label FPS;
@FXML
Label timeZone;
@FXML @FXML
TableView<BoatInRace> boatInfoTable; TableView<BoatInRace> boatInfoTable;
@ -170,8 +178,12 @@ public class RaceController extends Controller {
//timezone //timezone
TimeZoneLookup timeZoneLookup = new TimeZoneLookup(); TimeZoneLookup timeZoneLookup = new TimeZoneLookup();
TimeZoneResult timeZoneResult = timeZoneLookup.getTimeZone(raceXMLReader.getMark().getLatitude(), raceXMLReader.getMark().getLongitude()); TimeZoneResult timeZoneResult = timeZoneLookup.getTimeZone(raceXMLReader.getMark().getLatitude(), raceXMLReader.getMark().getLongitude());
System.out.println(timeZoneResult.getResult()); ZoneId zoneId = ZoneId.of(timeZoneResult.getResult());
LocalDateTime localDateTime = LocalDateTime.now(zoneId);
ZonedDateTime zonedDateTime =localDateTime.atZone(zoneId);
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd-MM HH:mm:ss z");
// System.out.println(dateTimeFormatter.format(zonedDateTime));
timeZone.setText(dateTimeFormatter.format(zonedDateTime));
initializeFPS(); initializeFPS();
initializeAnnotations(); initializeAnnotations();

@ -83,7 +83,7 @@
</TitledPane> </TitledPane>
</children> </children>
</Pane> </Pane>
<Label fx:id="timer" layoutX="45.0" layoutY="146.0" text="0:0" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" GridPane.halignment="RIGHT" GridPane.valignment="BOTTOM"> <Label fx:id="timer" layoutX="45.0" layoutY="146.0" maxHeight="20.0" text="0:0" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" GridPane.halignment="RIGHT" GridPane.valignment="BOTTOM">
<font> <font>
<Font name="System Bold" size="15.0" /> <Font name="System Bold" size="15.0" />
</font> </font>
@ -93,6 +93,14 @@
<Font name="System Bold" size="15.0" /> <Font name="System Bold" size="15.0" />
</font> </font>
</Label> </Label>
<Label fx:id="timeZone" GridPane.halignment="RIGHT" GridPane.valignment="BOTTOM">
<font>
<Font name="System Bold" size="15.0" />
</font>
<GridPane.margin>
<Insets bottom="20.0" />
</GridPane.margin>
</Label>
</children> </children>
</GridPane> </GridPane>
<AnchorPane layoutX="450.0" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="200.0" GridPane.columnIndex="1"> <AnchorPane layoutX="450.0" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="200.0" GridPane.columnIndex="1">

Loading…
Cancel
Save