-
Notifications
You must be signed in to change notification settings - Fork 2
/
Q20_Border_Layout.java
49 lines (32 loc) · 969 Bytes
/
Q20_Border_Layout.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
//Q20. WAP to arrange components using border layout.
package JAVA_Lab_File;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Color;
public class Q20_Border_Layout {
// Main Method
public static void main(String[] args) {
BorderDemo obj = new BorderDemo();
}
}
class BorderDemo extends JFrame{
public BorderDemo()
{
setLayout(new BorderLayout());
setBackground(Color.red);
Button btn1 = new Button("Zaphkiel's");
Button btn2 = new Button("Kurumi");
Button btn3 = new Button("Tokisaki");
Button btn4 = new Button("Nightmare");
Button btn5 = new Button("Darling");
add(btn1, "North");
add(btn2, "South");
add(btn3, "East");
add(btn4, "West");
add(btn5, "Center");
setTitle("Zaphkiel's Border Layout");
setSize(350, 300);
setVisible(true);
}
}