-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAdmin.java
88 lines (79 loc) · 3.25 KB
/
Admin.java
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package finalproject;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Admin extends JFrame {
private JPanel contentPane;
public Admin() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 775, 440);
contentPane = new JPanel();
contentPane.setBackground(new Color(137, 209, 194));
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JButton addboat = new JButton("View Cars");
addboat.setFont(new Font("Verdana", Font.PLAIN, 18));
addboat.setBounds(130, 100, 163, 46);
addboat.setBackground(new Color(248, 151, 29));
addboat.setBorder(null);
addboat.setForeground(new Color(255,255,255));
contentPane.add(addboat);
JButton btnDelete = new JButton("Customer Details");
btnDelete.setFont(new Font("Verdana", Font.PLAIN, 18));
btnDelete.setBounds(450, 100, 163, 46);
btnDelete.setBackground(new Color(248, 151, 29));
btnDelete.setForeground(new Color(255, 255, 255));
btnDelete.setBorder(null);
contentPane.add(btnDelete);
JButton viewOrders = new JButton("View Orders");
viewOrders.setFont(new Font("Verdana", Font.PLAIN, 18));
viewOrders.setBounds(450, 260, 163, 46);
viewOrders.setBackground(new Color(248, 151, 29));
viewOrders.setForeground(new Color(255, 255, 255));
viewOrders.setBorder(null);
contentPane.add(viewOrders);
JLabel lblNewLabel = new JLabel("Admin Page");
lblNewLabel.setFont(new Font("Verdana", Font.PLAIN, 26));
lblNewLabel.setForeground(new Color(248, 151, 29));
lblNewLabel.setBounds(281, 25, 224, 30);
contentPane.add(lblNewLabel);
JButton btnNewButton = new JButton("Dealer Details");
btnNewButton.setFont(new Font("Verdana", Font.PLAIN, 18));
btnNewButton.setBounds(130, 260, 163, 46);
btnNewButton.setBackground(new Color(248, 151, 29));
btnNewButton.setForeground(new Color(255,255,255));
btnNewButton.setBorder(null);
contentPane.add(btnNewButton);
}
public static void main(String[] args) {
String jdbcURL = "jdbc:postgresql://localhost:5432/houseboat";
String username = "postgres";
String password = "subbu0456";
try {
Connection connection = DriverManager.getConnection(jdbcURL, username, password);
System.out.print("Connected");
}
catch(SQLException e) {
System.out.println("Error in connection");
e.printStackTrace();
}
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Admin frame = new Admin();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}