Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javafx.fxml.FXML;
- import javafx.fxml.FXMLLoader;
- import javafx.scene.control.*;
- import javafx.scene.layout.Pane;
- import javafx.stage.Stage;
- import java.io.IOException;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.sql.*;
- public class LoginController {
- @FXML
- private Pane loginPane;
- @FXML
- private TextField loginTextField;
- @FXML
- private PasswordField hasloPasswordField;
- @FXML
- private Button closeButton;
- @FXML
- private void closeButtonAction(){
- Stage stage = (Stage) closeButton.getScene().getWindow();
- stage.close();
- }
- public void check() throws IOException, SQLException {
- Connection con_1 = DriverManager.getConnection("jdbc:mysql://localhost:3306/pkp","root","password");
- ResultSet rs = con_1.createStatement().executeQuery("SELECT NAZWISKO, HASLO_PRACOWNIKA FROM PERSONEL");
- ResultSet rs2 = con_1.createStatement().executeQuery("SELECT NAZWISKO,HASLO_KLIENTA FROM KLIENT");
- while(rs.next())
- {
- if(rs.getString("NAZWISKO").equals(loginTextField.getText()) && rs.getString("HASLO_PRACOWNIKA").equals(hasloPasswordField.getText()))
- {
- Worker w = new Worker();
- w.setName(loginTextField.getText());
- initializeWorkerPane();
- break;
- }
- }
- while(rs2.next())
- {
- if(rs2.getString("NAZWISKO").equals(loginTextField.getText()) && rs2.getString("HASLO_KLIENTA").equals(hasloPasswordField.getText()))
- {
- Client c = new Client();
- c.setName(loginTextField.getText());
- initializeClientPane();
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement