feat(graphique): ajout images, fix tailles gridpane

This commit is contained in:
bouclyma 2024-12-05 10:50:48 +01:00
parent 6d8ec5b7f5
commit bf1099609c
5 changed files with 25 additions and 15 deletions

View file

@ -3,10 +3,12 @@ package rtgre.chat;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import java.io.IOException;
import java.io.InputStream;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
@ -31,8 +33,10 @@ public class ChatApplication extends Application {
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.setMinWidth(800);
stage.setMinHeight(500);
stage.getIcons().add(new Image(Objects.requireNonNull(ChatApplication.class.getResourceAsStream("rt.png"))));
stage.setMinWidth(600);
stage.setMinHeight(400);
stage.setScene(scene);
stage.show();
}

View file

@ -3,9 +3,11 @@ package rtgre.chat;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import java.net.URL;
import java.util.Objects;
import java.util.ResourceBundle;
import java.util.logging.Logger;
@ -28,5 +30,9 @@ public class ChatController implements Initializable {
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
LOGGER.info("Initialisation de l'interface graphique");
Image image = new Image(Objects.requireNonNull(ChatController.class.getResourceAsStream("anonymous.png")));
this.avatarImageView.setImage(image);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View file

@ -19,7 +19,7 @@
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<VBox alignment="CENTER" minHeight="500.0" minWidth="800.0" prefHeight="500.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="rtgre.chat.ChatController">
<VBox alignment="CENTER" minHeight="400.0" minWidth="600.0" prefHeight="500.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="rtgre.chat.ChatController">
<children>
<MenuBar>
<menus>
@ -36,11 +36,11 @@
</Menu>
</menus>
</MenuBar>
<GridPane>
<GridPane maxWidth="1.7976931348623157E308">
<columnConstraints>
<ColumnConstraints hgrow="NEVER" maxWidth="94.0" minWidth="10.0" prefWidth="59.0" />
<ColumnConstraints hgrow="NEVER" maxWidth="286.0" minWidth="0.0" prefWidth="32.0" />
<ColumnConstraints hgrow="ALWAYS" minWidth="10.0" prefWidth="494.0" />
<ColumnConstraints hgrow="NEVER" maxWidth="107.0" minWidth="10.0" prefWidth="62.0" />
<ColumnConstraints hgrow="NEVER" maxWidth="286.0" minWidth="0.0" prefWidth="34.0" />
<ColumnConstraints hgrow="ALWAYS" minWidth="10.0" prefWidth="400.0" />
<ColumnConstraints halignment="RIGHT" hgrow="NEVER" maxWidth="131.0" minWidth="10.0" prefWidth="106.0" />
</columnConstraints>
<rowConstraints>
@ -48,33 +48,33 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Server :" />
<Label text="Login :" GridPane.rowIndex="1" />
<ComboBox fx:id="hostComboBox" maxWidth="1.7976931348623157E308" promptText="Choose host..." GridPane.columnIndex="2">
<Label text="Server :" GridPane.hgrow="NEVER" />
<Label text="Login :" GridPane.hgrow="NEVER" GridPane.rowIndex="1" />
<ComboBox fx:id="hostComboBox" maxWidth="1.7976931348623157E308" promptText="Choose host..." GridPane.columnIndex="2" GridPane.hgrow="ALWAYS">
<GridPane.margin>
<Insets bottom="5.0" top="5.0" />
</GridPane.margin>
</ComboBox>
<TextField fx:id="loginTextField" maxWidth="1.7976931348623157E308" GridPane.columnIndex="2" GridPane.rowIndex="1">
<TextField fx:id="loginTextField" maxWidth="1.7976931348623157E308" GridPane.columnIndex="2" GridPane.hgrow="ALWAYS" GridPane.rowIndex="1">
<GridPane.margin>
<Insets bottom="5.0" top="5.0" />
</GridPane.margin>
</TextField>
<ToggleButton fx:id="connectionButton" maxHeight="1.7976931348623157E308" mnemonicParsing="false" prefWidth="100.0" text="Connection" GridPane.columnIndex="3" GridPane.rowSpan="2">
<ToggleButton fx:id="connectionButton" maxHeight="1.7976931348623157E308" mnemonicParsing="false" prefWidth="100.0" text="Connection" GridPane.columnIndex="3" GridPane.halignment="RIGHT" GridPane.hgrow="NEVER" GridPane.rowSpan="2">
<GridPane.margin>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</GridPane.margin>
</ToggleButton>
<ImageView fx:id="avatarImageView" fitHeight="35.0" fitWidth="34.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<ImageView fx:id="avatarImageView" fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.hgrow="NEVER" GridPane.rowIndex="1" />
</children>
<VBox.margin>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</VBox.margin>
</GridPane>
<SplitPane fx:id="exchangeSplitPane" dividerPositions="0.5" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
<SplitPane fx:id="exchangeSplitPane" dividerPositions="0.9" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
<items>
<ListView fx:id="postListView" prefHeight="200.0" prefWidth="348.0" />
<SplitPane dividerPositions="0.5" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0">
<SplitPane dividerPositions="0.1" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0">
<items>
<ListView fx:id="roomsListView" prefHeight="200.0" prefWidth="200.0" />
<ListView fx:id="contactListView" prefHeight="200.0" prefWidth="200.0" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB