-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathText_Encryption.java
More file actions
67 lines (53 loc) · 1.75 KB
/
Copy pathText_Encryption.java
File metadata and controls
67 lines (53 loc) · 1.75 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
58
59
60
61
62
63
64
65
66
67
import java.awt.*;
import java.awt.event.*;
public class Text_Encryption extends Frame implements ActionListener{
Label text_label = new Label("Enter Text");
Label result_label = new Label("Result : ");
Label ed_label = new Label(" ");
TextField text = new TextField(20);
Panel p1 = new Panel();
Button btn_e = new Button("Encrypt");
Button btn_d = new Button("Decrypt");
Dimension d = new Dimension(600,100);
Text_Encryption()
{
setSize(600,600);
setTitle("Java CP");
setLayout(new FlowLayout(FlowLayout.CENTER, 0, 60));
addWindowListener (new WindowAdapter() {
public void windowClosing (WindowEvent e) {
dispose();
}
});
text_label.setFont(new Font("Times New Roman",Font.BOLD,20));
text.setFont(new Font("Times New Roman",Font.PLAIN,17));
add(text_label);
add(text);
p1.setLayout(new FlowLayout(FlowLayout.CENTER,40,0));
p1.setPreferredSize(d);
p1.add(btn_e);
p1.add(btn_d);
add(p1);
result_label.setFont(new Font("Times New Roman",Font.BOLD,20));
add(result_label);
add(ed_label);
btn_e.addActionListener(this);
btn_d.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
Object ref = e.getSource();
if(ref==btn_e)
setBackground(Color.RED);
else
if(ref==btn_d)
setBackground(Color.GREEN);
else
setBackground(Color.BLUE);
}
public static void main(String[] args)
{
Text_Encryption t = new Text_Encryption();
t.setVisible(true);
}
}