-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMySecondScreen.java
More file actions
60 lines (49 loc) · 1.44 KB
/
MySecondScreen.java
File metadata and controls
60 lines (49 loc) · 1.44 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
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JLabel;
public class MySecondScreen extends JFrame {
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
MySecondScreen frame = new MySecondScreen();
frame.setVisible(true);
}
private void print(String message){
JOptionPane.showMessageDialog(this, message);
}
/**
* Create the frame.
*/
public MySecondScreen() {
setBounds(100, 100, 450, 300);
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JButton btnOk = new JButton("Ok");
btnOk.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
print("U Click on Ok");
}
});
btnOk.setMnemonic('o');
btnOk.setFont(new Font("Lucida Grande", Font.BOLD, 18));
btnOk.setBounds(37, 44, 117, 29);
contentPane.add(btnOk);
JLabel lblWelcome = new JLabel("Welcome");
lblWelcome.setFont(new Font("Lucida Grande", Font.BOLD, 20));
lblWelcome.setBounds(151, 16, 184, 16);
contentPane.add(lblWelcome);
}
}