aboutsummaryrefslogtreecommitdiff
path: root/src/GUIComponents/GridPanel.java
blob: dc8d90425c9f0c4c355343a1288fb4d48874efdb (plain) (blame)
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
/*    */ package GUIComponents;
/*    */ 
/*    */ import java.awt.Component;
/*    */ import java.awt.FlowLayout;
/*    */ import java.awt.GridLayout;
/*    */ import javax.swing.JPanel;
/*    */ 
/*    */ public class GridPanel extends JPanel
/*    */ {
/*    */   private JPanel[][] panels;
/*    */ 
/*    */   public GridPanel(int width, int height, int spacingx, int spacingy)
/*    */   {
/* 18 */     this.panels = new JPanel[width][height];
/* 19 */     setLayout(new GridLayout(height, width));
/* 20 */     int i = 0; for (int a = 0; i < this.panels.length; a++) {
/* 21 */       for (int j = 0; j < this.panels[0].length; a++)
/*    */       {
/* 23 */         add(this.panels[i][j] =  = new JPanel(new FlowLayout()));
/*    */ 
/* 21 */         j++;
/*    */       }
/* 20 */       i++;
/*    */     }
/*    */   }
/*    */ 
/*    */   public void add(Component component, int col, int row)
/*    */   {
/* 30 */     this.panels[col][row].add(component);
/*    */   }
/*    */ }

/* Location:           Modulus.jar
 * Qualified Name:     GUIComponents.GridPanel
 * JD-Core Version:    0.6.2
 */