- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA1Test.java
More file actions
Latest commit
60 lines (41 loc) · 1.54 KB
/
Copy pathA1Test.java
File metadata and controls
60 lines (41 loc) · 1.54 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
packagepa;
importjavax.swing.*;
importjava.awt.*;
importjava.awt.event.*;
importjava.util.*;
importjava.text.*;
classA1extendsJFrameimplementsActionListener {
Containerc;
JButtonbtnTime;
A1() {
c = getContentPane();
c.setLayout(null);
btnTime = newJButton("Show Time");
btnTime.setBounds(100, 150, 300, 50);
Fontf = newFont("Impact", Font.BOLD + Font.ITALIC, 50);
btnTime.setFont(f);
c.add(btnTime);
btnTime.addActionListener(this);
setSize(500, 500);
setLocation(200, 100);
setTitle("Clock");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
getContentPane().setBackground(Color.PINK);
setIconImage(newImageIcon("image.png").getImage());
setResizable(false);
}
publicvoidactionPerformed(ActionEventae) {
if (ae.getSource() == btnTime) {
Dated = newDate();
DateFormatdf = DateFormat.getTimeInstance(DateFormat.FULL, newLocale("en", "IN"));
Stringds = df.format(d);
JOptionPane.showMessageDialog(c, ds);
}
}
}
classA1Test {
publicstaticvoidmain(Stringargs[]) {
A1a = newA1();
}
}