-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyMsgBox.java
64 lines (43 loc) · 1.35 KB
/
MyMsgBox.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
import java.awt.*;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class MyMsgBox extends JDialog {
public JPanel jp1,jp2,jp3;
public JLabel jlb1,jlb2;
public JButton jb1;
public MyMsgBox(String msg){
this.setModal(true);
jp1=new JPanel();
jp2=new JPanel();
jp3=new JPanel();
jlb1=new JLabel(msg);
jb1=new JButton("OK");
this.setLayout(new GridLayout(3, 1));
jp1.add(jlb1);
jp3.add(jb1);
this.add(jp1);
this.add(jp2);
this.add(jp3);
jb1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}
});
init();
}
public void clickon()
{
dispose();
}
public void init()
{
this.setTitle("Message");
this.setSize(300, 150);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
this.setVisible(true);
this.setResizable(false);
}
}