-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChangeNoteGUI.java
More file actions
78 lines (69 loc) · 2.34 KB
/
ChangeNoteGUI.java
File metadata and controls
78 lines (69 loc) · 2.34 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
77
78
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 ChangeNoteGUI extends JFrame {
private JPanel contentPane;
public ChangeNoteGUI() {
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 {
ChangeNoteGUI frame = new ChangeNoteGUI();
frame.setVisible(true);
if (x == true) {
JLabel note = new JLabel("修改成功!請重新登入。");
note.setFont(new Font("微軟正黑體", Font.PLAIN, 20));
note.setBounds(93, 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();
GUI reStart = new GUI();
reStart.run();
}
});
frame.getContentPane().add(note);
frame.getContentPane().add(colseButton);
}
else{
JLabel note = new JLabel("修改失敗!請確認輸入是否有誤。");
note.setFont(new Font("微軟正黑體", Font.PLAIN, 20));
note.setBounds(32, 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();
}
}
}