-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA1Test.java
More file actions
60 lines (41 loc) · 1.54 KB
/
A1Test.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
package pa;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.text.*;
class A1 extends JFrame implements ActionListener {
Container c;
JButton btnTime;
A1() {
c = getContentPane();
c.setLayout(null);
btnTime = new JButton("Show Time");
btnTime.setBounds(100, 150, 300, 50);
Font f = new Font("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(new ImageIcon("image.png").getImage());
setResizable(false);
}
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == btnTime) {
Date d = new Date();
DateFormat df = DateFormat.getTimeInstance(DateFormat.FULL, new Locale("en", "IN"));
String ds = df.format(d);
JOptionPane.showMessageDialog(c, ds);
}
}
}
class A1Test {
public static void main(String args[]) {
A1 a = new A1();
}
}