Add station selection window

This commit is contained in:
Nathan McRae 2024-12-29 15:55:59 -08:00
parent 3a45ca7ce2
commit fea5a35240
3 changed files with 46 additions and 3 deletions

View File

@ -55,7 +55,7 @@
<Insets right="10.0" />
</FlowPane.margin>
</TextField>
<Button mnemonicParsing="false" text="Select Station" />
<Button mnemonicParsing="false" onAction="#handleSelectStationButtonPress" text="Select Station" />
</children>
<VBox.margin>
<Insets bottom="10.0" />
@ -74,7 +74,7 @@
<Font size="14.0" />
</font>
</Label>
<Button layoutX="534.0" layoutY="13.0" mnemonicParsing="false" onAction="#handleButtonPress" onMouseClicked="#handleButtonPress" text="Station Settings" AnchorPane.rightAnchor="6.5" AnchorPane.topAnchor="13.0" />
<Button layoutX="534.0" layoutY="13.0" mnemonicParsing="false" onMouseClicked="#handleSettingsButtonPress" text="Station Settings" AnchorPane.rightAnchor="6.5" AnchorPane.topAnchor="13.0" />
</children>
</AnchorPane>
</children>

View File

@ -17,6 +17,8 @@ import java.util.ResourceBundle;
public class NumbersStationController implements Initializable {
private Stage settingsStage;
private Stage selectStationStage;
@FXML
private Label lastRetrievedLabel;
@ -24,7 +26,7 @@ public class NumbersStationController implements Initializable {
private TextArea messageTextArea;
@FXML
private void handleButtonPress() {
private void handleSettingsButtonPress() {
System.out.println("Button pressed!");
lastRetrievedLabel.setText("Button pressed!");
@ -44,6 +46,24 @@ public class NumbersStationController implements Initializable {
}
}
@FXML
private void handleSelectStationButtonPress() {
if (selectStationStage == null || !selectStationStage.isShowing()) {
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("NumbersStationSelection.fxml"));
Parent root = fxmlLoader.load();
selectStationStage = new Stage();
selectStationStage.setTitle("Numbers Station Selection");
selectStationStage.setScene(new Scene(root));
selectStationStage.show();
} catch (Exception e) {
e.printStackTrace();
}
} else {
selectStationStage.toFront();
}
}
@Override
public void initialize(URL location, ResourceBundle resources) {
messageTextArea.addEventFilter(KeyEvent.ANY, event -> {

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="437.0" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label layoutX="14.0" layoutY="14.0" text="Numbers Stations">
<font>
<Font size="20.0" />
</font>
</Label>
<Button layoutX="358.0" layoutY="17.0" mnemonicParsing="false" text="+" AnchorPane.rightAnchor="54.5" AnchorPane.topAnchor="17.0" />
<Button layoutX="391.0" layoutY="17.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="25.0" text="-" AnchorPane.rightAnchor="21.0" AnchorPane.topAnchor="17.0" />
<ListView layoutX="14.0" layoutY="57.0" prefHeight="301.0" prefWidth="409.0" AnchorPane.bottomAnchor="42.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="57.0" />
<Button layoutX="313.0" layoutY="365.0" mnemonicParsing="false" text="Select" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="76.5" />
<Button layoutX="370.0" layoutY="365.0" mnemonicParsing="false" text="Cancel" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="15.5" />
</children>
</AnchorPane>