Added JavaFX login dialog scene
This commit is contained in:
parent
5d76bbbcb0
commit
840ec53277
63
src/main/java/envoy/client/ui/LoginDialog.fxml
Normal file
63
src/main/java/envoy/client/ui/LoginDialog.fxml
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.control.Button?>
|
||||||
|
<?import javafx.scene.control.CheckBox?>
|
||||||
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.control.PasswordField?>
|
||||||
|
<?import javafx.scene.control.TextField?>
|
||||||
|
<?import javafx.scene.layout.ColumnConstraints?>
|
||||||
|
<?import javafx.scene.layout.GridPane?>
|
||||||
|
<?import javafx.scene.layout.HBox?>
|
||||||
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
|
<VBox maxHeight="-Infinity" maxWidth="-Infinity"
|
||||||
|
minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0"
|
||||||
|
prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1"
|
||||||
|
xmlns:fx="http://javafx.com/fxml/1"
|
||||||
|
fx:controller="envoy.client.ui.LoginDialogController">
|
||||||
|
<children>
|
||||||
|
<Label text="User Login">
|
||||||
|
<font>
|
||||||
|
<Font size="26.0" />
|
||||||
|
</font>
|
||||||
|
</Label>
|
||||||
|
<GridPane>
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES"
|
||||||
|
minWidth="10.0" percentWidth="40.0" prefWidth="100.0" />
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES"
|
||||||
|
minWidth="10.0" prefWidth="100.0" />
|
||||||
|
</columnConstraints>
|
||||||
|
<rowConstraints>
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0"
|
||||||
|
vgrow="SOMETIMES" />
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0"
|
||||||
|
vgrow="SOMETIMES" />
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0"
|
||||||
|
vgrow="SOMETIMES" />
|
||||||
|
</rowConstraints>
|
||||||
|
<children>
|
||||||
|
<Label text="User Name:" />
|
||||||
|
<Label text="Password" GridPane.rowIndex="1" />
|
||||||
|
<Label text="Repeat Password:" visible="false"
|
||||||
|
GridPane.rowIndex="2" fx:id="repeatPasswordLabel" />
|
||||||
|
<TextField GridPane.columnIndex="1" />
|
||||||
|
<PasswordField GridPane.columnIndex="1"
|
||||||
|
GridPane.rowIndex="1" fx:id="repeatPasswordField"/>
|
||||||
|
<PasswordField visible="false"
|
||||||
|
GridPane.columnIndex="1" GridPane.rowIndex="2" fx:id="repeatPasswordField"/>
|
||||||
|
</children>
|
||||||
|
</GridPane>
|
||||||
|
<CheckBox mnemonicParsing="false" text="Register" fx:id="registerCheckBox" onAction="#registerCheckboxChanged"/>
|
||||||
|
<HBox prefHeight="100.0" prefWidth="200.0">
|
||||||
|
<children>
|
||||||
|
<Button cancelButton="true" mnemonicParsing="false"
|
||||||
|
text="Cancel" onAction="#cancelButtonClicked"/>
|
||||||
|
<Button defaultButton="true" mnemonicParsing="false"
|
||||||
|
text="Submit" disable="true" onAction="#submitButtonClicked"/>
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
|
</children>
|
||||||
|
</VBox>
|
53
src/main/java/envoy/client/ui/LoginDialogController.java
Normal file
53
src/main/java/envoy/client/ui/LoginDialogController.java
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
package envoy.client.ui;
|
||||||
|
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.control.CheckBox;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.PasswordField;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Project: <strong>envoy-client</strong><br>
|
||||||
|
* File: <strong>LoginDialogController.java</strong><br>
|
||||||
|
* Created: <strong>03.04.2020</strong><br>
|
||||||
|
*
|
||||||
|
* @author Kai S. K. Engelbart
|
||||||
|
* @since Envoy Client v0.1-beta
|
||||||
|
*/
|
||||||
|
public final class LoginDialogController {
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private PasswordField passwordField;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private PasswordField repeatPasswordField;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Label repeatPasswordLabel;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private CheckBox registerCheckBox;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void registerCheckboxChanged() {
|
||||||
|
|
||||||
|
// Make repeat password field and label visible / invisible
|
||||||
|
repeatPasswordField.setVisible(registerCheckBox.isSelected());
|
||||||
|
repeatPasswordLabel.setVisible(registerCheckBox.isSelected());
|
||||||
|
|
||||||
|
// Clear repeat password field if registration cancelled
|
||||||
|
if (!registerCheckBox.isSelected()) repeatPasswordField.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void submitButtonClicked() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void cancelButtonClicked(ActionEvent e) { closeStage(e); }
|
||||||
|
|
||||||
|
private void closeStage(ActionEvent e) { ((Stage) ((Node) e.getSource()).getScene().getWindow()).close(); }
|
||||||
|
}
|
Reference in New Issue
Block a user