summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/CheckboxEditorDialog.java
blob: 66810077ed181f8c2dc22b63abc54781f44b9c76 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*    */ package NET.worlds.scape;
/*    */ 
/*    */ import NET.worlds.console.Console;
/*    */ import NET.worlds.console.OkCancelDialog;
/*    */ import java.awt.Checkbox;
/*    */ import java.awt.CheckboxGroup;
/*    */ import java.awt.Dimension;
/*    */ import java.awt.GridBagConstraints;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public abstract class CheckboxEditorDialog
/*    */   extends OkCancelDialog
/*    */ {
/*    */   private static final long serialVersionUID = 1L;
/* 21 */   private CheckboxGroup group = new CheckboxGroup();
/*    */   
/*    */   private Checkbox[] choices;
/*    */   private String[] labels;
/*    */   protected EditTile parent;
/*    */   
/*    */   protected CheckboxEditorDialog(EditTile parent, String title, String[] labels)
/*    */   {
/* 29 */     super(Console.getFrame(), parent, title);
/* 30 */     this.labels = labels;
/* 31 */     this.parent = parent;
/*    */   }
/*    */   
/*    */   protected void build()
/*    */   {
/* 36 */     this.choices = new Checkbox[this.labels.length];
/*    */     
/* 38 */     GridBagConstraints c = new GridBagConstraints();
/* 39 */     c.weightx = 1.0D;
/* 40 */     c.weighty = 1.0D;
/* 41 */     c.gridwidth = 0;
/* 42 */     for (int i = 0; i < this.labels.length; i++)
/* 43 */       add(this.gbag, this.choices[i] = new Checkbox(this.labels[i], this.group, false), c);
/* 44 */     super.build();
/*    */   }
/*    */   
/*    */   protected abstract int getValue();
/*    */   
/*    */   protected abstract void setValue(int paramInt);
/*    */   
/*    */   protected boolean setValue() {
/* 52 */     Checkbox selected = this.group.getSelectedCheckbox();
/* 53 */     for (int i = 0; i < this.choices.length; i++)
/* 54 */       if (this.choices[i] == selected) {
/* 55 */         setValue(i);
/* 56 */         return true;
/*    */       }
/* 58 */     return false;
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */   public void setVisible(boolean visible)
/*    */   {
/* 65 */     if (visible) {
/* 66 */       Dimension mySize = getSize();
/* 67 */       initialSize(mySize.width < 160 ? 160 : mySize.width, 
/* 68 */         mySize.height < 120 ? 120 : mySize.height);
/* 69 */       super.setVisible(visible);
/* 70 */       int choice = getValue();
/* 71 */       this.choices[choice].requestFocus();
/* 72 */       this.choices[choice].setState(true);
/*    */     } else {
/* 74 */       super.setVisible(visible);
/*    */     }
/*    */   }
/*    */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\CheckboxEditorDialog.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */