-
Notifications
You must be signed in to change notification settings - Fork 0
/
InputTaker.java
92 lines (81 loc) · 2.46 KB
/
InputTaker.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.geom.*;
class InputTaker extends JDialog
{
InputTaker y;
flash cover;
public InputTaker(String message,String enterWord,flash c)
{
super((JFrame)null,"",true);
y=this;
cover=c;
setSize(600,150);
setLocationRelativeTo(null);
setUndecorated(true);
setShape(new RoundRectangle2D.Double(0d,0d,getWidth()*1d,getHeight()*1d,60d,60d));
utility.GradientPanel pan=new utility.GradientPanel();
pan.setBackground(new Color(187, 143, 206));
pan.setLayout(new GridLayout(2,1));
JLabel a=new JLabel(message,JLabel.CENTER);
a.setFont(CONSTANTS.windowfont);
JTextField f=new JTextField();
f.setFont(CONSTANTS.generalfont);
utility.rgbButton b=new utility.rgbButton(enterWord);//tactile effect doesnt work
b.setTactileColor(Color.cyan);
utility.rgbButton can=new utility.rgbButton("Cancel");
pan.add(a);
pan.add(f);
pan.add(b);
pan.add(can);
setContentPane(pan);
can.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
closeAndReturn(null);
}
});
b.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
closeAndReturn(f.getText());
}
});
f.addKeyListener(new KeyAdapter()
{
public void keyReleased(KeyEvent e)
{
if(e.getKeyCode()==KeyEvent.VK_ENTER)
closeAndReturn(f.getText());
}
});
}
public void closeAndReturn(String s)
{
ret=s;
utility.disappearDialog(y);
new Thread(new Runnable()
{
public void run()
{
cover.lighten(1);
}
}).start();
}
String ret="";
public String run()
{
new Thread(new Runnable()
{
public void run()
{
cover.darken(1);
}
}).start();
utility.appearDialog(this);
return ret;
}
}