hanze/game-client

List view (12ea818c5198954d3089f6b27a963a3889f36570)
Repositories

commit 12ea818c5198954d3089f6b27a963a3889f36570
parent 3cfa4fb1c3f49c30499ac688fcdc43db29d6fe4b
Author: A Koens <[email protected]>
Date:   Thu, 13 Oct 2022 22:58:28 +0200

List view

observable list toegevoed met aantal dummy items.

Diffstat:
Msettings.properties4++--
Msrc/main/java/nl/isygameclient/Application.java2++
Msrc/main/java/nl/isygameclient/controllers/GameSelectorMenuController.java30++++++++++++++++++++++++++----
Msrc/main/resources/nl/isygameclient/css/style.css33+++++++++++++++++++--------------
Msrc/main/resources/nl/isygameclient/views/GameSelectorMenu.fxml56+++++++++++++++++++++++++++++++-------------------------
5 files changed, 80 insertions(+), 45 deletions(-)

diff --git a/settings.properties b/settings.properties @@ -1,6 +1,6 @@ #Application Settings -#Thu Oct 13 12:30:42 CEST 2022 +#Thu Oct 13 22:35:41 CEST 2022 screenWidth=680 -fullscreen=true +fullscreen=false screenHeight=480 title=ISY Game Client diff --git a/src/main/java/nl/isygameclient/Application.java b/src/main/java/nl/isygameclient/Application.java @@ -13,6 +13,8 @@ public class Application extends javafx.application.Application { Scene scene = new Scene(fxmlLoader.load()); primaryStage.setTitle(SettingsHandler.getSettings().getTitle()); primaryStage.setScene(scene); + primaryStage.setHeight(SettingsHandler.getSettings().getScreenHeight()); + primaryStage.setWidth(SettingsHandler.getSettings().getScreenWidth()); primaryStage.setFullScreen(SettingsHandler.getSettings().isFullscreen()); primaryStage.show(); primaryStage.setOnCloseRequest((windowEvent) -> { diff --git a/src/main/java/nl/isygameclient/controllers/GameSelectorMenuController.java b/src/main/java/nl/isygameclient/controllers/GameSelectorMenuController.java @@ -1,15 +1,37 @@ package nl.isygameclient.controllers; -import javafx.scene.control.Button; +import javafx.application.Platform; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.fxml.FXML; +import javafx.scene.control.ListView; import javafx.scene.control.TextField; +import javafx.scene.layout.Pane; public class GameSelectorMenuController { + @FXML public TextField searchBox; - public Button searchDeleteButton; - public void handleClearSearchText() { + @FXML + public ListView<String> gamesList; - } + public GameSelectorMenuController() { + ObservableList<String> candidates = FXCollections.observableArrayList( + "Super man", + "Spider man", + "Wolverine", + "Police", + "Fire Rescue", + "Soldiers", + "Dad & Mom", + "Doctor", + "Politician", + "Pastor", + "Teacher"); + Platform.runLater(() -> { + this.gamesList.setItems(candidates); + }); + } } diff --git a/src/main/resources/nl/isygameclient/css/style.css b/src/main/resources/nl/isygameclient/css/style.css @@ -1,21 +1,27 @@ - .search-bar { - -fx-padding: 0 0 0 25; - -fx-text-fill: -md-sys-color-inverse-surface; - -fx-border-color: -md-sys-color-on-surface; - -fx-border-width: 2; - -fx-border-radius: 10 10 10 10; + -fx-border-color: -md-sys-color-on-surface; + -fx-border-width: 2; + -fx-border-radius: 10 10 10 10; +} + +.search-field { + -fx-padding: 0 0 0 35; + -fx-text-fill: -md-sys-color-inverse-surface; } -.searchIcon { - -fx-padding: 0 0 0 5; - -fx-fill: -md-ref-palette-neutral-variant95 + +.icon { + -fx-fill: -md-sys-color-inverse-surface; } -.menu-bar { - -fx-stroke: -md-sys-color-outline-dark; - -fx-stroke-width: 5; +.menu-bar-settings { + -fx-fill: -md-sys-color-inverse-surface; } .transparent { -fx-background-color: transparent; -} -\ No newline at end of file +} + +#gamesList { + -fx-margin: 10 0 0 0; + -fx-background-radius: 10; +} diff --git a/src/main/resources/nl/isygameclient/views/GameSelectorMenu.fxml b/src/main/resources/nl/isygameclient/views/GameSelectorMenu.fxml @@ -7,77 +7,83 @@ <?import com.jfoenix.controls.*?> +<?import javafx.geometry.Insets?> <AnchorPane minHeight="480.0" minWidth="600.0" prefHeight="1080.0" prefWidth="1920.0" styleClass="inverse-on-surface" stylesheets="@../css/theme.css" xmlns="http://javafx.com/javafx/16" xmlns:fx="http://javafx.com/fxml/1" fx:controller="nl.isygameclient.controllers.GameSelectorMenuController"> <BorderPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <top> - <HBox prefHeight="50.0" prefWidth="600.0" BorderPane.alignment="CENTER"> + <HBox prefHeight="50.0" prefWidth="Infinity"> <styleClass> <String fx:value="menu-bar"/> <String fx:value="surface"/> </styleClass> <JFXButton text="Store" disable="true" prefHeight="Infinity"> <styleClass> - <String fx:value="title-large"/> + <String fx:value="title-medium"/> <String fx:value="on-surface-text"/> </styleClass> </JFXButton> <JFXButton text="Games" prefHeight="Infinity"> <styleClass> - <String fx:value="title-large"/> + <String fx:value="title-medium"/> <String fx:value="on-surface-text"/> </styleClass> </JFXButton> <JFXButton text="User" disable="true" prefHeight="Infinity"> <styleClass> - <String fx:value="title-large"/> + <String fx:value="title-medium"/> <String fx:value="on-surface-text"/> </styleClass> </JFXButton> - <VBox HBox.hgrow="ALWAYS"/> - <JFXButton> + + <Pane HBox.hgrow="ALWAYS"/> + <JFXButton textAlignment="RIGHT" text="Settings" prefHeight="Infinity"> <styleClass> - <String fx:value=""/> + <String fx:value="title-medium"/> + <String fx:value="on-surface-text"/> </styleClass> - <graphic> - <MaterialIconView glyphName="SETTINGS" glyphSize="50"/> - </graphic> </JFXButton> </HBox> </top> <left> - <AnchorPane BorderPane.alignment="CENTER"> - <VBox prefWidth="300" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" + <AnchorPane> + <VBox prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> - <Label alignment="CENTER" styleClass="background-text" text="Games"> - </Label> - <StackPane styleClass="highlight-rectangle"> - <TextField fx:id="searchBox" promptText="Search" prefHeight="30.0"> + <StackPane styleClass="search-bar" minHeight="35.0"> + <TextField fx:id="searchBox" promptText="Search" prefHeight="40.0"> <styleClass> - <String fx:value="search-bar"/> + <String fx:value="search-field"/> <String fx:value="transparent"/> </styleClass> </TextField> - <JFXButton StackPane.alignment="CENTER_LEFT" styleClass="searchIcon"> + + + <JFXButton StackPane.alignment="CENTER_LEFT" prefHeight="40.0" disable="true"> <graphic> - <MaterialIconView glyphName="SEARCH" glyphSize="20" /> + <MaterialIconView StackPane.alignment="CENTER_LEFT" glyphName="SEARCH" glyphSize="20" styleClass="icon"/> </graphic> </JFXButton> + + <JFXButton StackPane.alignment="CENTER_RIGHT" prefHeight="40.0"> + <graphic> + <MaterialIconView glyphName="CLOSE" glyphSize="16" styleClass="icon"/> + </graphic> + </JFXButton> + </StackPane> - <ListView VBox.vgrow="ALWAYS" styleClass="background" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" - AnchorPane.topAnchor="0.0"/> + <ListView fx:id="gamesList" VBox.vgrow="ALWAYS" styleClass="surface"> + <padding> + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> + </padding> + </ListView> </VBox> </AnchorPane> </left> <center> - <VBox BorderPane.alignment="CENTER"> - <Label styleClass="error-container-text" text="Label"/> - <Separator maxWidth="50.0" prefWidth="10.0"/> - </VBox> </center> </BorderPane> </AnchorPane>