COMP2396
Loading...
Searching...
No Matches
FlowLayoutEx.java
Go to the documentation of this file.
1import javax.swing.*;
2import java.awt.*;
3
4public class FlowLayoutEx {
5 public static void main(String[] args) {
6 FlowLayoutEx gui = new FlowLayoutEx();
7 gui.go();
8 }
9
10 public void go() {
11 JFrame frame = new JFrame();
12 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
13 JPanel panel = new JPanel();
14 panel.setBackground(Color.DARK_GRAY);
15 frame.add(panel, BorderLayout.EAST);
16 frame.setSize(250, 200);
17 frame.setVisible(true);
18 }
19
20 /* public void go() {
21 JFrame frame = new JFrame();
22 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
23 JPanel panel = new JPanel();
24 panel.setBackground(Color.DARK_GRAY);
25 JButton button = new JButton("shock me");
26 panel.add(button);
27 frame.add(panel, BorderLayout.EAST);
28 frame.setSize(250, 200); frame.setVisible(true);
29 } */
30
31 /* public void go() {
32 JFrame frame = new JFrame();
33 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
34 JPanel panel = new JPanel();
35 panel.setBackground(Color.DARK_GRAY);
36 JButton button = new JButton("shock me");
37 JButton button2 = new JButton("bliss");
38 panel.add(button);
39 panel.add(button2);
40 frame.add(panel, BorderLayout.EAST);
41 frame.setSize(250, 200); frame.setVisible(true);
42 } */
43
44 /* public void go() {
45 JFrame frame = new JFrame();
46 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
47 JPanel panel = new JPanel();
48 panel.setBackground(Color.DARK_GRAY);
49 panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
50 JButton button = new JButton("shock me");
51 JButton button2 = new JButton("bliss");
52 panel.add(button);
53 panel.add(button2);
54 frame.add(panel, BorderLayout.EAST);
55 frame.setSize(250, 200);
56 frame.setVisible(true);
57 } */
58}
static void main(String[] args)