This commit is contained in:
2025-10-01 20:48:55 -04:00
parent c3114e52c7
commit f924528596
3 changed files with 23 additions and 4 deletions

View File

@@ -23,5 +23,4 @@ public class TestMainFx extends Application {
public static void main(String[] args) { public static void main(String[] args) {
launch(args); launch(args);
} }
} }

View File

@@ -0,0 +1,20 @@
package lodge;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
public class TestMainFxCommandButtonEventController {
@FXML
private Button btnAdd;
@FXML
private void initialize() {
btnAdd.setOnAction((ev) -> {
Platform.exit();
});
}
}

View File

@@ -46,7 +46,7 @@
<?import javafx.scene.paint.Color?> <?import javafx.scene.paint.Color?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<VBox prefHeight="600.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/24.0.1" xmlns:fx="http://javafx.com/fxml/1"> <VBox fx:controller="lodge.TestMainFxCommandButtonEventController" prefHeight="600.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/24.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children> <children>
<SplitPane dividerPositions="0.11469933184855234" focusTraversable="true" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS"> <SplitPane dividerPositions="0.11469933184855234" focusTraversable="true" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS">
<items> <items>
@@ -66,7 +66,7 @@
<children> <children>
<ButtonBar layoutY="71.0" prefHeight="40.0" prefWidth="129.0"> <ButtonBar layoutY="71.0" prefHeight="40.0" prefWidth="129.0">
<buttons> <buttons>
<Button mnemonicParsing="false" prefHeight="30.0" text="Add" /> <Button fx:id="btnAdd" mnemonicParsing="false" prefHeight="30.0" text="Add" />
</buttons> </buttons>
</ButtonBar> </ButtonBar>
</children></AnchorPane> </children></AnchorPane>