improved the createUserController.java and the create-user.fxml
This commit is contained in:
parent
226255f75a
commit
7c8b1fefb7
@ -12,13 +12,17 @@ import java.util.Objects;
|
||||
public class MainApplication extends Application {
|
||||
@Override
|
||||
public void start(Stage stage) throws IOException {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("main-view.fxml"));
|
||||
//wieder ändern zu main-view.fxml
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("../users/create-user.fxml"));
|
||||
|
||||
Scene scene = new Scene(fxmlLoader.load(), 1200, 700);
|
||||
scene.getStylesheets().add(Objects.requireNonNull(
|
||||
MainApplication.class.getResource("main-view.css")).toExternalForm());
|
||||
//wieder ändern zu main-view.css
|
||||
MainApplication.class.getResource("../users/create-user.css")).toExternalForm());
|
||||
stage.setTitle("SharePlaner");
|
||||
stage.setScene(scene);
|
||||
//wieder löschen
|
||||
stage.show();
|
||||
|
||||
FXMLLoader fxmlLoaderLogin = new FXMLLoader(MainApplication.class.getResource("../users/login.fxml"));
|
||||
Scene sceneLogin = new Scene(fxmlLoaderLogin.load(), 650, 500);
|
||||
|
@ -1,7 +1,13 @@
|
||||
package users;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class CreateUserController {
|
||||
|
||||
@ -9,4 +15,27 @@ public class CreateUserController {
|
||||
public TextField textPassword;
|
||||
public TextField textPasswordSecond;
|
||||
public CheckBox checkBoxIsAdmin;
|
||||
public Label labelErrorName;
|
||||
public Label labelErrorPw;
|
||||
|
||||
protected void createUser(ActionEvent event) {
|
||||
if (textName.getText().trim().isEmpty()) {
|
||||
labelErrorName.setText("Bitte Usernamen eingeben!");
|
||||
labelErrorPw.setText("");
|
||||
return;
|
||||
}
|
||||
if (textPassword.getText().trim().isEmpty()) {
|
||||
labelErrorName.setText("");
|
||||
labelErrorPw.setText("Bitte Passwort eingeben!");
|
||||
return;
|
||||
}
|
||||
if (Objects.equals(textPassword.getText(), textPasswordSecond.getText())){
|
||||
labelErrorName.setText("");
|
||||
labelErrorPw.setText("Passwörter stimmen nicht überein!");
|
||||
return;
|
||||
}
|
||||
|
||||
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||
stage.close();
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
<ColumnConstraints/>
|
||||
<ColumnConstraints/>
|
||||
<ColumnConstraints/>
|
||||
<ColumnConstraints/>
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints vgrow="ALWAYS" />
|
||||
@ -17,19 +18,23 @@
|
||||
<RowConstraints vgrow="ALWAYS" />
|
||||
<RowConstraints vgrow="ALWAYS" />
|
||||
<RowConstraints vgrow="ALWAYS" />
|
||||
<RowConstraints vgrow="ALWAYS" />
|
||||
</rowConstraints>
|
||||
|
||||
<Label styleClass="mainLabel">User anlegen</Label>
|
||||
<Label styleClass="mainLabel" GridPane.columnIndex="2" GridPane.columnSpan="2" >User anlegen</Label>
|
||||
|
||||
<Label styleClass="inputLabel" GridPane.rowIndex="1">Name:</Label>
|
||||
<Label styleClass="inputLabel" GridPane.rowIndex="3">Passwort:</Label>
|
||||
<Label styleClass="inputLabel" GridPane.rowIndex="4">Passwort wiederholen:</Label>
|
||||
<Label styleClass="inputLabel" GridPane.rowIndex="6">Admin:</Label>
|
||||
<Label styleClass="inputLabel" GridPane.rowIndex="1" GridPane.columnIndex="1">Name:</Label>
|
||||
<Label styleClass="inputLabel" GridPane.rowIndex="3" GridPane.columnIndex="1">Passwort:</Label>
|
||||
<Label styleClass="inputLabel" GridPane.rowIndex="4" GridPane.columnIndex="1">Passwort wiederholen:</Label>
|
||||
<Label styleClass="inputLabel" GridPane.rowIndex="6" GridPane.columnIndex="1">Admin:</Label>
|
||||
|
||||
<TextField fx:id="textName" GridPane.columnIndex="2" GridPane.rowIndex="1" maxWidth="400" minWidth="400"/>
|
||||
<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"/>
|
||||
|
||||
<Label fx:id="labelErrorName" GridPane.columnIndex="3" GridPane.rowIndex="1"/>
|
||||
<Label fx:id="labelErrorPw" GridPane.columnIndex="3" GridPane.rowIndex="3"/>
|
||||
</GridPane>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user