Skip to content

Commit 0ef0b23

Browse files
committed
ui, add possibility of hiding the toolbar
* This enables the user to create a 'guessing game'
1 parent 95fad2d commit 0ef0b23

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Simulator that simulates the characteristics and recurrence of navigational ligh
1010
* Selection of groups e.g. for occulting lights
1111
* Selection of recurrence of a light
1212
* Start/Stop the simulation
13+
* Hide toolbar on double clicking the light pane
1314

1415
## Screenshot
1516

src/main/java/de/szilch/leuchtfeuer/controller/NavLightController.java

+15-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
import javafx.scene.control.Label;
1313
import javafx.scene.control.Slider;
1414
import javafx.scene.control.ToggleButton;
15+
import javafx.scene.control.ToolBar;
16+
import javafx.scene.input.MouseButton;
17+
import javafx.scene.input.MouseEvent;
1518
import javafx.scene.shape.Circle;
16-
17-
import java.net.URL;
1819
import java.util.Arrays;
19-
import java.util.ResourceBundle;
2020

2121
/**
2222
* Controller for Frontend!
@@ -39,6 +39,9 @@ public class NavLightController {
3939
@FXML
4040
private ToggleButton tglStartStop;
4141

42+
@FXML
43+
private ToolBar toolBar;
44+
4245
private NavLightExecutor executor;
4346
private NavLight navLight;
4447

@@ -91,6 +94,15 @@ public void initialize() {
9194
tglStartStop.selectedProperty().addListener((observable, oldValue, newValue) -> simulate());
9295
}
9396

97+
public void setFullscreen(MouseEvent event) {
98+
if (event.getButton().equals(MouseButton.PRIMARY)) {
99+
if (event.getClickCount() == 2) {
100+
toolBar.setVisible(!toolBar.isVisible());
101+
toolBar.setManaged(toolBar.isVisible());
102+
}
103+
}
104+
}
105+
94106
private void setMinimalRecurrence() {
95107
long minimal = navLight.getMinimumRecurrenceInSec();
96108
if (minimal > 0 && sdrRecurrences.getValue() < minimal && !sdrRecurrences.isDisable()) {

src/main/resources/de/szilch/leuchtfeuer/mainframe.fxml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<?import javafx.scene.shape.Circle?>
66
<BorderPane prefHeight="768" prefWidth="1024" xmlns="http://javafx.com/javafx/8.0.102-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.szilch.leuchtfeuer.controller.NavLightController">
77
<top>
8-
<ToolBar prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER">
8+
<ToolBar fx:id="toolBar" prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER">
99
<items>
1010
<GridPane hgap="10">
1111
<columnConstraints>
@@ -36,7 +36,7 @@
3636
</ToolBar>
3737
</top>
3838
<center>
39-
<Pane prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: #000;" BorderPane.alignment="CENTER">
39+
<Pane prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: #000;" BorderPane.alignment="CENTER" onMouseClicked="#setFullscreen">
4040
<children>
4141
<Circle fx:id="fire" fill="#078d32" layoutX="512.0" layoutY="364.0" radius="100.0" stroke="BLACK" strokeType="INSIDE" visible="false"/>
4242
</children>

0 commit comments

Comments
 (0)