-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMyFirstFrame.java
More file actions
44 lines (37 loc) · 928 Bytes
/
Copy pathMyFirstFrame.java
File metadata and controls
44 lines (37 loc) · 928 Bytes
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
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import java.awt.Font;
public class MyFirstFrame extends JFrame {
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MyFirstFrame frame = new MyFirstFrame();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public MyFirstFrame() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
this.getContentPane().setLayout(null);
JButton btnOk = new JButton("Ok");
btnOk.setFont(new Font("Tahoma", Font.BOLD, 18));
btnOk.setBounds(108, 48, 89, 23);
getContentPane().add(btnOk);
}
}