-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRequestLabel.java
More file actions
51 lines (44 loc) · 961 Bytes
/
RequestLabel.java
File metadata and controls
51 lines (44 loc) · 961 Bytes
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
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class RequestLabel extends JDialog implements ActionListener
{
private Controller contr;
private JTextField label;
private JButton ok;
public RequestLabel(Frame owner,String title)
{
super(owner,"Label of "+title,true);
Container c = getContentPane();
c.setLayout(new FlowLayout(FlowLayout.CENTER,10,20));
setSize(200,150);
contr = (Controller)owner;
label = new JTextField("",15);
c.add(label);
label.addActionListener(this);
ok = new JButton("OK");
c.add(ok);
ok.addActionListener(this);
setVisible(true);
}
public void actionPerformed(ActionEvent ae)
{
if (ae.getSource() == ok)
{
if (label == null)
{
dispose();
}
else
{
contr.label = label.getText();
if (contr.label.equals(""))
{
new Error(this);
}
else
dispose();
}
}
}
}