61 lines
1.6 KiB
Java
61 lines
1.6 KiB
Java
package de.vanitasvitae.fasel.ui.fragment;
|
|
|
|
import java.io.IOException;
|
|
|
|
import com.jfoenix.controls.JFXButton;
|
|
import com.jfoenix.controls.JFXPasswordField;
|
|
import com.jfoenix.controls.JFXTextField;
|
|
import de.vanitasvitae.fasel.FaselApplication;
|
|
import javafx.event.ActionEvent;
|
|
import javafx.event.EventHandler;
|
|
import javafx.fxml.FXML;
|
|
import javafx.fxml.FXMLLoader;
|
|
import javafx.scene.Parent;
|
|
import javafx.scene.Scene;
|
|
|
|
public class LoginFragmentController {
|
|
|
|
@FXML
|
|
private JFXTextField text_username;
|
|
|
|
@FXML
|
|
private JFXPasswordField text_password;
|
|
|
|
@FXML
|
|
private JFXButton button_login;
|
|
|
|
private FaselApplication main;
|
|
|
|
@FXML
|
|
private void initialize() {
|
|
button_login.setOnAction(new EventHandler<ActionEvent>() {
|
|
@Override
|
|
public void handle(ActionEvent actionEvent) {
|
|
String username = text_username.getText();
|
|
String password = text_password.getText();
|
|
|
|
try {
|
|
switchToMainScene();
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
private void switchToMainScene() throws IOException {
|
|
FXMLLoader loader = new FXMLLoader();
|
|
loader.setLocation(getClass().getResource("/fxml/container/main_container.fxml"));
|
|
Parent root = loader.load();
|
|
|
|
Scene scene = new Scene(root, 1200, 741);
|
|
main.getPrimaryStage().setTitle("Hello World");
|
|
main.getPrimaryStage().setScene(scene);
|
|
// primaryStage.show();
|
|
}
|
|
|
|
public void setApplication(FaselApplication main) {
|
|
this.main = main;
|
|
}
|
|
}
|