-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathLesson2.java
More file actions
34 lines (29 loc) · 953 Bytes
/
Copy pathLesson2.java
File metadata and controls
34 lines (29 loc) · 953 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
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class Frame {
public static void main(String[] args) {
JFrame frame = new JFrame();
JPanel panel = new JPanel();
JLabel label = new JLabel("Some text");
JButton btn1 = new JButton("Click me!");
JTextArea txtArea = new JTextArea();
JTextField txtField = new JTextField(200);
panel.setLayout(new BorderLayout());
panel.add(label, BorderLayout.NORTH);
panel.add(btn1, BorderLayout.WEST);
panel.add(txtArea, BorderLayout.CENTER);
frame.add(panel);
frame.setResizable(false);
frame.setVisible(true);
frame.setPreferredSize(new Dimension(840, 840/12*9));
frame.setSize(840, 840/12*9);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}