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 List _listField = new List(5, false); protected EditTile _parent; protected ListChooserDialog(EditTile parent, String title) { super(Console.getFrame(), parent, title); this._parent = parent; } @Override protected void build() { GridBagConstraints c = new GridBagConstraints(); c.weightx = 1.0; c.weighty = 1.0; c.gridwidth = 0; c.fill = 1; this.add(this.gbag, this._listField, c); super.build(); } protected abstract String getEntry(int var1); protected abstract int getSelected(); protected abstract boolean setValue(String var1, int var2); @Override protected boolean setValue() { return this.setValue(this._listField.getSelectedItem(), this._listField.getSelectedIndex()); } @Override public void show() { super.show(); int index = 0; for (String entry = this.getEntry(index); entry != null; entry = this.getEntry(++index)) { this._listField.addItem(entry, index); } index = this.getSelected(); if (index != -1) { this._listField.select(index); } this._listField.requestFocus(); } }