forked from feazizoglu/UCSS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
30 lines (26 loc) · 1.06 KB
/
Main.java
File metadata and controls
30 lines (26 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import Utils.DatabaseConnection;
import Utils.DatabaseInitializer;
import View.LoginPanel;
import javax.swing.*;
import java.sql.Connection;
public class Main {
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
try (Connection connection = DatabaseConnection.getDataSource().getConnection()) {
// Veritabanını başlat
DatabaseInitializer.initializeDatabase(connection);
// Yeni bir bağlantı oluştur ve GUI'ye aktar
Connection guiConnection = DatabaseConnection.getDataSource().getConnection();
// Login panelini başlat
JFrame frame = new JFrame("Login");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(600, 300);
frame.setLocationRelativeTo(null);
frame.add(new LoginPanel(frame, guiConnection));
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
});
}
}