Login Scene is not resizable, logo gets loaded correctly

This commit is contained in:
DieGurke 2020-07-16 16:02:03 +02:00
parent 1e63c1a7d1
commit e7e4c5af42
3 changed files with 10 additions and 1 deletions

View File

@ -125,6 +125,8 @@ public final class SceneContext {
sceneStack.push(scene); sceneStack.push(scene);
stage.setScene(scene); stage.setScene(scene);
if (sceneInfo == SceneInfo.LOGIN_SCENE) stage.setResizable(false);
else stage.setResizable(true);
applyCSS(); applyCSS();
stage.sizeToScene(); stage.sizeToScene();
stage.show(); stage.show();

View File

@ -11,10 +11,12 @@ import javafx.fxml.FXML;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Alert.AlertType;
import javafx.scene.image.ImageView;
import envoy.client.data.*; import envoy.client.data.*;
import envoy.client.net.Client; import envoy.client.net.Client;
import envoy.client.net.WriteProxy; import envoy.client.net.WriteProxy;
import envoy.client.ui.IconUtil;
import envoy.client.ui.SceneContext; import envoy.client.ui.SceneContext;
import envoy.client.ui.Startup; import envoy.client.ui.Startup;
import envoy.data.LoginCredentials; import envoy.data.LoginCredentials;
@ -61,6 +63,9 @@ public final class LoginScene {
@FXML @FXML
private Label registerTextLabel; private Label registerTextLabel;
@FXML
private ImageView logo;
private Client client; private Client client;
private LocalDB localDB; private LocalDB localDB;
private CacheMap cacheMap; private CacheMap cacheMap;
@ -78,6 +83,8 @@ public final class LoginScene {
// Show an alert after an unsuccessful handshake // Show an alert after an unsuccessful handshake
eventBus.register(HandshakeRejection.class, e -> Platform.runLater(() -> { new Alert(AlertType.ERROR, e.get()).showAndWait(); })); eventBus.register(HandshakeRejection.class, e -> Platform.runLater(() -> { new Alert(AlertType.ERROR, e.get()).showAndWait(); }));
logo.setImage(IconUtil.loadIcon("envoy_logo"));
} }
/** /**

View File

@ -16,7 +16,7 @@
<VBox id="loginBackground" alignment="TOP_CENTER" prefHeight="500.0" prefWidth="350.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="envoy.client.ui.controller.LoginScene"> <VBox id="loginBackground" alignment="TOP_CENTER" prefHeight="500.0" prefWidth="350.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="envoy.client.ui.controller.LoginScene">
<children> <children>
<ImageView fitHeight="80.0" fitWidth="80.0" pickOnBounds="true" preserveRatio="true"> <ImageView fx:id="logo" fitHeight="80.0" fitWidth="80.0" pickOnBounds="true" preserveRatio="true">
<VBox.margin> <VBox.margin>
<Insets bottom="10.0" top="50.0" /> <Insets bottom="10.0" top="50.0" />
</VBox.margin> </VBox.margin>