-
Notifications
You must be signed in to change notification settings - Fork 0
/
JPP.java
52 lines (31 loc) · 903 Bytes
/
JPP.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
48
49
50
51
52
import javax.swing.*;
import java.awt.*;
import java.awt.Container;
import java.awt.event.*;
class MyFrame extends JFrame{
Container c;
JPanel panel,panel2;
JButton btn;
public MyFrame(){
c=this.getContentPane();
c.setLayout(null);
panel=new JPanel();
c.add(panel);
panel.setBackground(Color.ORANGE);
panel.setBounds(40,40,200,200);
btn=new JButton("Click Me");
panel.add(btn);
panel2=new JPanel();
panel.add(panel2);
panel2.setBackground(Color.BLACK);
panel2.setBounds(40,40,100,100);
}}
class JPP{//JPanel
public static void main(String args[]){
MyFrame frame = new MyFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(100,100,800,500);
frame.setTitle("JPanel");
frame.setBackground(Color.WHITE);
frame.setVisible(true);
}}