-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPanels.java
47 lines (39 loc) · 1.08 KB
/
Panels.java
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
import java.awt.Color;
import java.awt.Font;
import javax.swing.*;
public class Panels {
JFrame f;
JLabel l1;
Panels(){
f=new JFrame();
l1=new JLabel();
l1.setText("Panel Check");
//l1.setBounds(0, 0, 100, 30);
l1.setVerticalAlignment(JLabel.TOP);
l1.setHorizontalAlignment(JLabel.LEFT);
l1.setFont(new Font("MV Boli",Font.ITALIC,20));
JPanel redpanel=new JPanel();
redpanel.setBackground(Color.red);
redpanel.setBounds(0, 0, 250,250);
//redpanel.setLayout(null);
JPanel bluepanel=new JPanel();
bluepanel.setBackground(Color.blue);
bluepanel.setBounds(250, 0, 250,250);
//bluepanel.setLayout(null);
JPanel greenpanel=new JPanel();
greenpanel.setBackground(Color.green);
greenpanel.setBounds(0, 250, 500,250);
//greenpanel.setLayout(null);
f.add(redpanel);
f.add(bluepanel);
f.add(greenpanel);
redpanel.add(l1);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(750,750);
f.setLayout(null);
f.setVisible(true);
}
public static void main(String args[]) {
new Panels();
}
}