-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainScreen.java
140 lines (117 loc) · 3.76 KB
/
MainScreen.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
package windows;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import database.Delete;
import database.Insert;
import database.Print;
import database.Spotify;
import database.Update;
import java.awt.GridLayout;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Font;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JLabel;
import java.awt.Color;
import javax.swing.SwingConstants;
public class MainScreen extends JFrame {
private JPanel contentPane;
JButton insert = new JButton("INSERT");
JButton update = new JButton("UPDATE");
JButton select = new JButton("SELECT");
JButton delete = new JButton("DELETE");
JButton print_all = new JButton("PRINT ALL");
JButton exit = new JButton("EXIT");
JLabel press_exit = new JLabel("Press exit to terminate");
JScrollPane scrollPane = new JScrollPane();
public static JTextArea textArea = new JTextArea();
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainScreen frame = new MainScreen();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public MainScreen() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 800, 700);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
insert.setFont(new Font("Marker Felt", Font.PLAIN, 17));
insert.setBounds(25, 34, 134, 40);
contentPane.add(insert);
insert.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new InsertScreen().setVisible(true);
}
});
update.setFont(new Font("Marker Felt", Font.PLAIN, 17));
update.setBounds(334, 34, 134, 40);
contentPane.add(update);
update.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new UpdateScreen().setVisible(true);
}
});
select.setFont(new Font("Marker Felt", Font.PLAIN, 17));
select.setBounds(180, 34, 134, 40);
contentPane.add(select);
select.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new SelectScreen().setVisible(true);
}
});
delete.setFont(new Font("Marker Felt", Font.PLAIN, 17));
delete.setBounds(490, 34, 134, 40);
contentPane.add(delete);
delete.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new DeleteScreen().setVisible(true);
}
});
print_all.setFont(new Font("Marker Felt", Font.PLAIN, 17));
print_all.setBounds(645, 34, 134, 40);
contentPane.add(print_all);
print_all.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Print.printAll();
}
});
scrollPane.setBounds(25, 112, 754, 445);
contentPane.add(scrollPane);
textArea.setFont(new Font("Courier", Font.PLAIN, 14));
scrollPane.setViewportView(textArea);
textArea.setText("... Connected to database " + Spotify.db + " in MySQL with " + Spotify.conn.toString() + " ...\n");
exit.setFont(new Font("Marker Felt", Font.PLAIN, 13));
exit.setBounds(329, 617, 142, 29);
contentPane.add(exit);
exit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Spotify.close();
}
});
press_exit.setHorizontalAlignment(SwingConstants.CENTER);
press_exit.setForeground(new Color(0, 0, 0));
press_exit.setFont(new Font("Marker Felt", Font.PLAIN, 28));
press_exit.setBounds(0, 571, 800, 44);
contentPane.add(press_exit);
}
}