summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/ListChooserDialog.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-12 22:33:32 -0800
committerFuwn <[email protected]>2026-02-12 22:33:32 -0800
commitc7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch)
treedf9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/scape/ListChooserDialog.java
downloadworldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz
worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip
Initial commit
Diffstat (limited to 'NET/worlds/scape/ListChooserDialog.java')
-rw-r--r--NET/worlds/scape/ListChooserDialog.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/NET/worlds/scape/ListChooserDialog.java b/NET/worlds/scape/ListChooserDialog.java
new file mode 100644
index 0000000..8b9f1ff
--- /dev/null
+++ b/NET/worlds/scape/ListChooserDialog.java
@@ -0,0 +1,55 @@
+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();
+ }
+}