Updated create-user, css and the controller
This commit is contained in:
parent
7c8b1fefb7
commit
6e6183bf38
@ -1,10 +1,11 @@
|
|||||||
package users;
|
package users;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.CheckBox;
|
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.control.ToggleButton;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -14,28 +15,41 @@ public class CreateUserController {
|
|||||||
public TextField textName;
|
public TextField textName;
|
||||||
public TextField textPassword;
|
public TextField textPassword;
|
||||||
public TextField textPasswordSecond;
|
public TextField textPasswordSecond;
|
||||||
public CheckBox checkBoxIsAdmin;
|
public ToggleButton checkButtonIsAdmin;
|
||||||
public Label labelErrorName;
|
public TextField textLogin;
|
||||||
public Label labelErrorPw;
|
public TextField textForename;
|
||||||
|
public Label labelError;
|
||||||
|
|
||||||
|
@FXML
|
||||||
protected void createUser(ActionEvent event) {
|
protected void createUser(ActionEvent event) {
|
||||||
|
if (textLogin.getText().trim().isEmpty()){
|
||||||
|
labelError.setText("Bitte Login Namen angeben");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (textForename.getText().trim().isEmpty()) {
|
||||||
|
labelError.setText("Bitte Vornamen eingeben!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (textName.getText().trim().isEmpty()) {
|
if (textName.getText().trim().isEmpty()) {
|
||||||
labelErrorName.setText("Bitte Usernamen eingeben!");
|
labelError.setText("Bitte Nachnamen eingeben!");
|
||||||
labelErrorPw.setText("");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (textPassword.getText().trim().isEmpty()) {
|
if (textPassword.getText().trim().isEmpty()) {
|
||||||
labelErrorName.setText("");
|
labelError.setText("Bitte Passwort eingeben!");
|
||||||
labelErrorPw.setText("Bitte Passwort eingeben!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Objects.equals(textPassword.getText(), textPasswordSecond.getText())){
|
if (!Objects.equals(textPassword.getText(), textPasswordSecond.getText())){
|
||||||
labelErrorName.setText("");
|
labelError.setText("Passwörter stimmen nicht überein!");
|
||||||
labelErrorPw.setText("Passwörter stimmen nicht überein!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||||
stage.close();
|
stage.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
protected void abortBtnClick(ActionEvent event) {
|
||||||
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||||
|
stage.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1,56 @@
|
|||||||
|
* {
|
||||||
|
-fx-base-background-color: #2B2D42;
|
||||||
|
-fx-base1-background-color: #525E74;
|
||||||
|
|
||||||
|
-fx-main-border-color: #B0B0B0;
|
||||||
|
-fx-main-text-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GridPane{
|
||||||
|
-fx-background-color: #3E415F;
|
||||||
|
-fx-padding: 20px;
|
||||||
|
-fx-font-size: 20px;
|
||||||
|
-fx-font-family: Segoe UI;
|
||||||
|
|
||||||
|
-fx-border-insets: 1;
|
||||||
|
-fx-border-color: #B0B0B0;
|
||||||
|
-fx-border-style: solid;
|
||||||
|
-fx-border-width: 2;
|
||||||
|
-fx-effect: dropshadow(three-pass-box, rgba(100, 100, 100, 1), 24, 0.5, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mainLabel{
|
||||||
|
-fx-padding: 10px;
|
||||||
|
-fx-max-width: 400px;
|
||||||
|
-fx-min-width: 400px;
|
||||||
|
-fx-font-weight: bold;
|
||||||
|
-fx-alignment: top-center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Label{
|
||||||
|
-fx-text-fill: white;
|
||||||
|
-fx-max-width: 150px;
|
||||||
|
-fx-min-width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.textField{
|
||||||
|
-fx-max-width: 400px;
|
||||||
|
-fx-min-width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.errorMessage{
|
||||||
|
-fx-max-width: 400px;
|
||||||
|
-fx-min-width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
Button{
|
||||||
|
-fx-max-width: 150px;
|
||||||
|
-fx-min-width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnLogin{
|
||||||
|
-fx-font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
<GridPane xmlns="http://javafx.com/javafx"
|
<GridPane xmlns="http://javafx.com/javafx"
|
||||||
xmlns:fx="http://javafx.com/fxml"
|
xmlns:fx="http://javafx.com/fxml"
|
||||||
fx:controller="users.CreateUserController">
|
fx:controller="users.CreateUserController">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints/>
|
<ColumnConstraints minWidth="100"/>
|
||||||
<ColumnConstraints/>
|
<ColumnConstraints minWidth="100"/>
|
||||||
<ColumnConstraints/>
|
<ColumnConstraints minWidth="100"/>
|
||||||
<ColumnConstraints/>
|
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints vgrow="ALWAYS" />
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
@ -19,22 +19,38 @@
|
|||||||
<RowConstraints vgrow="ALWAYS" />
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
<RowConstraints vgrow="ALWAYS" />
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
<RowConstraints vgrow="ALWAYS" />
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
|
|
||||||
<Label styleClass="mainLabel" GridPane.columnIndex="2" GridPane.columnSpan="2" >User anlegen</Label>
|
<Label styleClass="mainLabel" GridPane.columnIndex="2" >User anlegen</Label>
|
||||||
|
|
||||||
<Label styleClass="inputLabel" GridPane.rowIndex="1" GridPane.columnIndex="1">Name:</Label>
|
<Label styleClass="inputLabel" GridPane.rowIndex="1" GridPane.columnIndex="1">Login:</Label>
|
||||||
<Label styleClass="inputLabel" GridPane.rowIndex="3" GridPane.columnIndex="1">Passwort:</Label>
|
<Label styleClass="inputLabel" GridPane.rowIndex="2" GridPane.columnIndex="1">Vorname:</Label>
|
||||||
<Label styleClass="inputLabel" GridPane.rowIndex="4" GridPane.columnIndex="1">Passwort wiederholen:</Label>
|
<Label styleClass="inputLabel" GridPane.rowIndex="3" GridPane.columnIndex="1">Nachname:</Label>
|
||||||
<Label styleClass="inputLabel" GridPane.rowIndex="6" GridPane.columnIndex="1">Admin:</Label>
|
<Label styleClass="inputLabel" GridPane.rowIndex="4" GridPane.columnIndex="1">Passwort:</Label>
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="5" GridPane.columnIndex="1">Passwort wiederholen:</Label>
|
||||||
|
|
||||||
<TextField fx:id="textName" GridPane.columnIndex="2" GridPane.rowIndex="1" maxWidth="400" minWidth="400"/>
|
<Label styleClass="inputLabelAdmin" GridPane.rowIndex="6" GridPane.columnIndex="1">Admin:</Label>
|
||||||
<TextField fx:id="textPassword" GridPane.columnIndex="2" GridPane.rowIndex="3" maxWidth="400" minWidth="400"/>
|
|
||||||
<TextField fx:id="textPasswordSecond" GridPane.columnIndex="2" GridPane.rowIndex="4" maxWidth="400" minWidth="400"/>
|
|
||||||
|
|
||||||
<CheckBox fx:id="checkBoxIsAdmin" GridPane.columnIndex="2" GridPane.rowIndex="6"/>
|
<TextField fx:id="textLogin" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="1" />
|
||||||
|
<TextField fx:id="textForename" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="2" />
|
||||||
|
<TextField fx:id="textName" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="3" />
|
||||||
|
<TextField fx:id="textPassword" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="4" />
|
||||||
|
<TextField fx:id="textPasswordSecond" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="5" />
|
||||||
|
|
||||||
<Label fx:id="labelErrorName" GridPane.columnIndex="3" GridPane.rowIndex="1"/>
|
<ToggleButton fx:id="checkButtonIsAdmin" GridPane.columnIndex="2" GridPane.rowIndex="6"/>
|
||||||
<Label fx:id="labelErrorPw" GridPane.columnIndex="3" GridPane.rowIndex="3"/>
|
|
||||||
|
<Label fx:id="labelError" styleClass="errorMessage" GridPane.columnIndex="2" GridPane.rowIndex="7"/>
|
||||||
|
|
||||||
|
<HBox GridPane.columnIndex="2" GridPane.rowIndex="8" alignment="CENTER_RIGHT">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets right="100" left="100"/>
|
||||||
|
</HBox.margin>
|
||||||
|
<Button onAction="#abortBtnClick">Abbrechen</Button>
|
||||||
|
<Button onAction="#createUser" styleClass="btnLogin" >Anmelden</Button>
|
||||||
|
|
||||||
|
</HBox>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user