Commit 386a95d1 authored by Trisha Gee's avatar Trisha Gee
Browse files

[Ch15] Button1 for all borderlayout regions

parent 39fd926f
Loading
Loading
Loading
Loading
+14 −5
Changes for src/main/java/ch15/Button1.java: 14 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -11,11 +11,20 @@ public class Button1 {

  public void go() {
    JFrame frame = new JFrame();
    JButton button = new JButton("Click This!");
    Font bigFont = new Font("serif", Font.BOLD, 28);
    button.setFont(bigFont);
    frame.getContentPane().add(BorderLayout.NORTH, button);
    frame.setSize(200, 200);

    JButton east = new JButton("East");
    JButton west = new JButton("West");
    JButton north = new JButton("North");
    JButton south = new JButton("South");
    JButton center = new JButton("Center");

    frame.getContentPane().add(BorderLayout.EAST, east);
    frame.getContentPane().add(BorderLayout.WEST, west);
    frame.getContentPane().add(BorderLayout.NORTH, north);
    frame.getContentPane().add(BorderLayout.SOUTH, south);
    frame.getContentPane().add(BorderLayout.CENTER, center);

    frame.setSize(300, 300);
    frame.setVisible(true);
  }
}