home *** CD-ROM | disk | FTP | other *** search
- import com.sun.java.swing.AbstractListModel;
- import com.sun.java.swing.ComboBoxModel;
- import com.sun.java.swing.ImageIcon;
- import java.util.Hashtable;
-
- class ComboBoxPanel$CustomComboBoxModel extends AbstractListModel implements ComboBoxModel {
- // $FF: synthetic field
- private final ComboBoxPanel this$0;
- Object currentValue;
- ImageIcon[] images;
- ImageIcon[] images_down;
- Hashtable[] cache;
-
- public ComboBoxPanel$CustomComboBoxModel(ComboBoxPanel var1) {
- this.this$0 = var1;
- this.this$0 = var1;
- this.images = new ImageIcon[5];
- this.images_down = new ImageIcon[5];
- this.images[0] = SwingSet.sharedInstance().loadImageIcon("images/list/a1.gif", "blue profile of robot");
- this.images_down[0] = SwingSet.sharedInstance().loadImageIcon("images/list/a1d.gif", "greyed out blue profile of robot");
- this.images[1] = SwingSet.sharedInstance().loadImageIcon("images/list/a2.gif", "pinkish profile of robot");
- this.images_down[1] = SwingSet.sharedInstance().loadImageIcon("images/list/a2d.gif", "greyed out pinkish profile of robot");
- this.images[2] = SwingSet.sharedInstance().loadImageIcon("images/list/a3.gif", "yellow profile of robot");
- this.images_down[2] = SwingSet.sharedInstance().loadImageIcon("images/list/a3d.gif", "greyed out yellow profile of robot");
- this.images[3] = SwingSet.sharedInstance().loadImageIcon("images/list/a4.gif", "green profile of robot");
- this.images_down[3] = SwingSet.sharedInstance().loadImageIcon("images/list/a4d.gif", "greyed out green profile of robot");
- this.images[4] = SwingSet.sharedInstance().loadImageIcon("images/list/a5.gif", "profile of robot");
- this.images_down[4] = SwingSet.sharedInstance().loadImageIcon("images/list/a5d.gif", "greyed out profile of robot");
- this.cache = new Hashtable[this.getSize()];
- }
-
- public void setSelectedItem(Object var1) {
- this.currentValue = var1;
- ((AbstractListModel)this).fireContentsChanged(this, -1, -1);
- }
-
- public Object getSelectedItem() {
- return this.currentValue;
- }
-
- public int getSize() {
- return 25;
- }
-
- public Object getElementAt(int var1) {
- if (this.cache[var1] != null) {
- return this.cache[var1];
- } else {
- Hashtable var2 = new Hashtable();
- if (var1 != 24) {
- var2.put("title", "Hello I'm the choice " + var1);
- var2.put("image", this.images[var1 % 5]);
- var2.put("Himage", this.images_down[var1 % 5]);
- } else {
- var2.put("title", "Hello I'm Duke");
- var2.put("image", this.this$0.swing.dukeSnooze);
- var2.put("Himage", this.this$0.swing.dukeWave);
- }
-
- this.cache[var1] = var2;
- return var2;
- }
- }
- }
-