mirror of
https://github.com/sabazadam/Se302.git
synced 2025-12-31 20:31:22 +00:00
first commit
This commit is contained in:
8
src/main/java/module-info.java
Normal file
8
src/main/java/module-info.java
Normal file
@@ -0,0 +1,8 @@
|
||||
module org.example.se302 {
|
||||
requires javafx.controls;
|
||||
requires javafx.fxml;
|
||||
|
||||
|
||||
opens org.example.se302 to javafx.fxml;
|
||||
exports org.example.se302;
|
||||
}
|
||||
19
src/main/java/org/example/se302/HelloApplication.java
Normal file
19
src/main/java/org/example/se302/HelloApplication.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package org.example.se302;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class HelloApplication extends Application {
|
||||
@Override
|
||||
public void start(Stage stage) throws IOException {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml"));
|
||||
Scene scene = new Scene(fxmlLoader.load(), 320, 240);
|
||||
stage.setTitle("Hello!");
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
}
|
||||
14
src/main/java/org/example/se302/HelloController.java
Normal file
14
src/main/java/org/example/se302/HelloController.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package org.example.se302;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Label;
|
||||
|
||||
public class HelloController {
|
||||
@FXML
|
||||
private Label welcomeText;
|
||||
|
||||
@FXML
|
||||
protected void onHelloButtonClick() {
|
||||
welcomeText.setText("Welcome to JavaFX Application!");
|
||||
}
|
||||
}
|
||||
9
src/main/java/org/example/se302/Launcher.java
Normal file
9
src/main/java/org/example/se302/Launcher.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package org.example.se302;
|
||||
|
||||
import javafx.application.Application;
|
||||
|
||||
public class Launcher {
|
||||
public static void main(String[] args) {
|
||||
Application.launch(HelloApplication.class, args);
|
||||
}
|
||||
}
|
||||
16
src/main/resources/org/example/se302/hello-view.fxml
Normal file
16
src/main/resources/org/example/se302/hello-view.fxml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<VBox alignment="CENTER" spacing="20.0" xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="org.example.se302.HelloController">
|
||||
<padding>
|
||||
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/>
|
||||
</padding>
|
||||
|
||||
<Label fx:id="welcomeText"/>
|
||||
<Button text="Hello!" onAction="#onHelloButtonClick"/>
|
||||
</VBox>
|
||||
Reference in New Issue
Block a user