Skip to content

Commit b205739

Browse files
committed
basic GUI in swing
1 parent b450014 commit b205739

File tree

3 files changed

+139
-33
lines changed

3 files changed

+139
-33
lines changed

.idea/workspace.xml

Lines changed: 100 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
1.4 KB
Binary file not shown.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.example.hello_world_package;
2+
3+
4+
import javax.swing.*;
5+
import java.awt.*;
6+
7+
public class Layout_Managers_one {
8+
public static void main(String[] args) {
9+
JFrame frame = new JFrame("FRAME FROM SWING CLASS");
10+
Panel panel = new Panel();
11+
frame.add(panel);
12+
frame.setVisible(true);
13+
frame.setSize(300,300);
14+
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
15+
16+
17+
18+
19+
BorderLayout borderLayout = new BorderLayout();
20+
21+
panel.setLayout(borderLayout);
22+
Button b1 = new Button("b1");
23+
Button b2 = new Button("b2");
24+
Button b3 = new Button("b3");
25+
Button b4 = new Button("b4");
26+
Button b5 = new Button("b5");
27+
28+
panel.add(b1,borderLayout.NORTH);
29+
panel.add(b2,borderLayout.SOUTH);
30+
panel.add(b3,borderLayout.EAST);
31+
panel.add(b4,borderLayout.WEST);
32+
panel.add(b5,borderLayout.CENTER);
33+
34+
35+
36+
37+
}
38+
}
39+

0 commit comments

Comments
 (0)