-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChooseNoteGUI.java
More file actions
76 lines (68 loc) · 2.29 KB
/
ChooseNoteGUI.java
File metadata and controls
76 lines (68 loc) · 2.29 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
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
package finalProject;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
public class ChooseNoteGUI extends JFrame {
private JPanel contentPane;
public ChooseNoteGUI() {
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //點擊關閉時只關閉目前視窗
setBounds(100, 100, 410, 212);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
}
public void run(boolean x) {
try {
ChooseNoteGUI frame = new ChooseNoteGUI();
frame.setVisible(true);
frame.setVisible(true);
if (x == true) {
JLabel note = new JLabel("選課成功!");
note.setFont(new Font("微軟正黑體", Font.PLAIN, 20));
note.setBounds(150, 55, 387, 23);
contentPane.add(note);
JButton colseButton = new JButton("確認");
colseButton.setBackground(SystemColor.controlHighlight);
colseButton.setFont(new Font("微軟正黑體", Font.PLAIN, 18));
colseButton.setBounds(140, 100, 111, 31);
contentPane.add(colseButton);
colseButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
}
});
frame.getContentPane().add(note);
frame.getContentPane().add(colseButton);
}
else{
JLabel note = new JLabel("選課失敗!");
note.setFont(new Font("微軟正黑體", Font.PLAIN, 20));
note.setBounds(150, 55, 387, 23);
contentPane.add(note);
JButton colseButton = new JButton("確認");
colseButton.setBackground(SystemColor.controlHighlight);
colseButton.setFont(new Font("微軟正黑體", Font.PLAIN, 18));
colseButton.setBounds(140, 100, 111, 31);
contentPane.add(colseButton);
colseButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
}
});
frame.getContentPane().add(note);
frame.getContentPane().add(colseButton);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}