Skip to content
Snippets Groups Projects
Commit 16466960 authored by iliya's avatar iliya
Browse files

feat: trying to setup JavaFX

parent 54911b96
No related branches found
No related tags found
No related merge requests found
package hepia; package hepia;
public class MainUI { import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class MainUI extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("main-ui.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
} }
package hepia; package hepia;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
public class MainUIController { public class MainUIController {
@FXML
private Label label;
public void initialize() {
label = new Label("Init gang");
}
@FXML
private void handleButton(ActionEvent e) {
label.setText("idk what's happening ngl...");
}
} }
...@@ -3,10 +3,9 @@ ...@@ -3,10 +3,9 @@
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.14-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="hepia.MainUIController">
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.14-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="hepia.MainUI">
<children> <children>
<Button layoutX="190.0" layoutY="211.0" mnemonicParsing="false" prefHeight="78.0" prefWidth="221.0" text="Click" /> <Button layoutX="190.0" layoutY="211.0" mnemonicParsing="false" onAction="#handleButton" prefHeight="78.0" prefWidth="221.0" text="Click" />
<TextField layoutX="219.0" layoutY="113.0" /> <Label fx:id="label" layoutX="223.0" layoutY="119.0" prefHeight="18.0" prefWidth="155.0" text="Label" textAlignment="JUSTIFY" />
</children> </children>
</AnchorPane> </AnchorPane>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment