(int grid)
| 22 | } |
| 23 | }; |
| 24 | public Boxes(int grid) { |
| 25 | setTitle("Demonstrates Observer pattern"); |
| 26 | Container cp = getContentPane(); |
| 27 | cp.setLayout(new GridLayout(grid, grid)); |
| 28 | for(int x = 0; x < grid; x++) |
| 29 | for(int y = 0; y < grid; y++) |
| 30 | cp.add(new Box(x, y, notifier)); |
| 31 | setSize(500, 400); |
| 32 | setVisible(true); |
| 33 | setDefaultCloseOperation(DISPOSE_ON_CLOSE); |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | @SuppressWarnings("deprecation") |