summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/ListChooserDialog.java
blob: 9fc74c59db73cbcfb2790d72e3791e8b4fc23d81 (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.GridBagConstraints;
/*    */ import java.awt.List;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public abstract class ListChooserDialog
/*    */   extends OkCancelDialog
/*    */ {
/*    */   private static final long serialVersionUID = 1L;
/* 18 */   private List _listField = new List(5, false);
/*    */   protected EditTile _parent;
/*    */   
/*    */   protected ListChooserDialog(EditTile parent, String title) {
/* 22 */     super(Console.getFrame(), parent, title);
/* 23 */     this._parent = parent;
/*    */   }
/*    */   
/*    */   protected void build() {
/* 27 */     GridBagConstraints c = new GridBagConstraints();
/* 28 */     c.weightx = 1.0D;
/* 29 */     c.weighty = 1.0D;
/* 30 */     c.gridwidth = 0;
/* 31 */     c.fill = 1;
/* 32 */     add(this.gbag, this._listField, c);
/* 33 */     super.build();
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */   protected abstract String getEntry(int paramInt);
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */   protected abstract int getSelected();
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */   protected abstract boolean setValue(String paramString, int paramInt);
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */   protected boolean setValue()
/*    */   {
/* 56 */     return setValue(this._listField.getSelectedItem(), this._listField.getSelectedIndex());
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */   public void setVisible(boolean visible)
/*    */   {
/* 63 */     super.setVisible(visible);
/* 64 */     if (visible) {
/* 65 */       int index = 0;
/* 66 */       String entry = getEntry(index);
/* 67 */       while (entry != null) {
/* 68 */         this._listField.add(entry, index);
/* 69 */         entry = getEntry(++index);
/*    */       }
/* 71 */       index = getSelected();
/* 72 */       if (index != -1)
/* 73 */         this._listField.select(index);
/* 74 */       this._listField.requestFocus();
/*    */     }
/*    */   }
/*    */ }


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