aboutsummaryrefslogtreecommitdiff
path: root/src/GUIComponents/JOptionPanel.java
blob: 08ec6a3de7ac653bb64a226d91abc0da4aab4b50 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*    */ package GUIComponents;
/*    */ 
/*    */ import java.awt.BorderLayout;
/*    */ import java.awt.Dimension;
/*    */ import java.awt.GridLayout;
/*    */ import javax.swing.BorderFactory;
/*    */ import javax.swing.JPanel;
/*    */ import javax.swing.border.TitledBorder;
/*    */ 
/*    */ public class JOptionPanel extends JPanel
/*    */ {
/*    */   private JPanel[] panels;
/*    */ 
/*    */   public JOptionPanel(String[] titles, JPanel[] p)
/*    */   {
/* 19 */     setLayout(new GridLayout(getCount(titles), 1));
/* 20 */     if (p != null) {
/* 21 */       this.panels = p;
/*    */     }
/*    */     else {
/* 24 */       this.panels = new JPanel[titles.length];
/* 25 */       for (int i = 0; i < this.panels.length; i++) {
/* 26 */         this.panels[i] = new JPanel(new BorderLayout());
/* 27 */         this.panels[i].setPreferredSize(new Dimension(getWidth(), getHeight() / titles.length));
/*    */       }
/*    */     }
/* 30 */     for (int i = 0; i < titles.length; i++)
/* 31 */       if (titles[i] != null) {
/* 32 */         if (!titles[i].equals("")) {
/* 33 */           TitledBorder titledBorder = BorderFactory.createTitledBorder(titles[i]);
/* 34 */           this.panels[i].setBorder(titledBorder);
/*    */ 
/* 36 */           if (i == 0) String str1 = "Center";
/* 37 */           String layout;
/* 37 */           if (i == 1) layout = "North"; else
/* 38 */             layout = "South";
/*    */         }
/* 40 */         add(this.panels[i], i);
/*    */       }
/*    */   }
/*    */ 
/*    */   public JOptionPanel(String[] titles) {
/* 45 */     this(titles, null);
/*    */   }
/*    */   public int getCount(Object[] obj) {
/* 48 */     int i = 0;
/* 49 */     for (Object x : obj) {
/* 50 */       if (x != null) i++;
/*    */     }
/* 52 */     return i;
/*    */   }
/*    */   public JPanel getPanel(int index) {
/* 55 */     return this.panels[index];
/*    */   }
/*    */ }

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