-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAboutDialog.java
58 lines (49 loc) · 1.26 KB
/
AboutDialog.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
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class AboutDialog extends JDialog implements ActionListener
{
public AboutDialog(JFrame owner)
{
super(owner, true);
setTitle(" About");
setSize(300, 400);
setResizable(false);
setLocationRelativeTo(this);
initPanel();
setVisible(true);
}
private void initPanel()
{
Container aboutContent = getContentPane();
aboutContent.setLayout(new BorderLayout());
JButton okBtn = new JButton("OK");
okBtn.addActionListener(this);
JPanel bottomPanel = new JPanel();
bottomPanel.setLayout(new FlowLayout());
bottomPanel.add(okBtn);
//aboutContent.add(new RemarkPanel(new Comment("Testing...")), BorderLayout.CENTER);
aboutContent.add(bottomPanel, BorderLayout.PAGE_END);
}
public void actionPerformed(ActionEvent evt)
{
try
{
String btnText = evt.getActionCommand();
if(btnText.equals("OK"))
{
setVisible(false);
dispose();
}
}
catch(Exception e)
{
StringWriter errors = new StringWriter();
e.printStackTrace(new PrintWriter(errors));
JOptionPane.showMessageDialog(this, errors.toString(), "Error!", JOptionPane.ERROR_MESSAGE);
System.out.println(errors.toString());
}
}
}