20 lines
575 B
Java
20 lines
575 B
Java
// ui/GridLayout1.java
|
|
// (c)2016 MindView LLC: see Copyright.txt
|
|
// We make no guarantees that this code is fit for any purpose.
|
|
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
|
// Demonstrates GridLayout.
|
|
import javax.swing.*;
|
|
import java.awt.*;
|
|
import static onjava.SwingConsole.*;
|
|
|
|
public class GridLayout1 extends JFrame {
|
|
public GridLayout1() {
|
|
setLayout(new GridLayout(7,3));
|
|
for(int i = 0; i < 20; i++)
|
|
add(new JButton("Button " + i));
|
|
}
|
|
public static void main(String[] args) {
|
|
run(new GridLayout1(), 300, 300);
|
|
}
|
|
}
|