mirror of
https://github.com/Akomry/sae302_applicom.git
synced 2025-12-06 11:43:53 +00:00
Création de l'application Java-FX, changement du titre de la fenêtre.
This commit is contained in:
parent
7cb887b34e
commit
da87040ec2
10 changed files with 681 additions and 0 deletions
8
chat/src/main/java/module-info.java
Normal file
8
chat/src/main/java/module-info.java
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
module rtgre.chat {
|
||||
requires javafx.controls;
|
||||
requires javafx.fxml;
|
||||
|
||||
|
||||
opens rtgre.chat to javafx.fxml;
|
||||
exports rtgre.chat;
|
||||
}
|
||||
23
chat/src/main/java/rtgre/chat/ChatApplication.java
Normal file
23
chat/src/main/java/rtgre/chat/ChatApplication.java
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package rtgre.chat;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ChatApplication extends Application {
|
||||
@Override
|
||||
public void start(Stage stage) throws IOException {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(ChatApplication.class.getResource("chat-view.fxml"));
|
||||
Scene scene = new Scene(fxmlLoader.load(), 320, 240);
|
||||
stage.setTitle("Chat @BOUCLY_Emi (B2GA)");
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch();
|
||||
}
|
||||
}
|
||||
14
chat/src/main/java/rtgre/chat/ChatController.java
Normal file
14
chat/src/main/java/rtgre/chat/ChatController.java
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package rtgre.chat;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Label;
|
||||
|
||||
public class ChatController {
|
||||
@FXML
|
||||
private Label welcomeText;
|
||||
|
||||
@FXML
|
||||
protected void onHelloButtonClick() {
|
||||
welcomeText.setText("Welcome to JavaFX Application!");
|
||||
}
|
||||
}
|
||||
16
chat/src/main/resources/rtgre/chat/chat-view.fxml
Normal file
16
chat/src/main/resources/rtgre/chat/chat-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="rtgre.chat.ChatController">
|
||||
<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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue