-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWrongNoteGUI.java
More file actions
57 lines (47 loc) · 1.52 KB
/
WrongNoteGUI.java
File metadata and controls
57 lines (47 loc) · 1.52 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
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 WrongNoteGUI extends JFrame {
private JPanel contentPane;
public WrongNoteGUI() {
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() {
try {
WrongNoteGUI frame = new WrongNoteGUI();
frame.setVisible(true);
JLabel note = new JLabel("檔案不存在!請重新確認。");
note.setFont(new Font("微軟正黑體", Font.PLAIN, 20));
note.setBounds(78, 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.add(note);
frame.add(colseButton);
} catch (Exception e) {
e.printStackTrace();
}
}
}