diff options
| author | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
| commit | c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch) | |
| tree | df9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/scape/FieldEditorDialog.java | |
| download | worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip | |
Initial commit
Diffstat (limited to 'NET/worlds/scape/FieldEditorDialog.java')
| -rw-r--r-- | NET/worlds/scape/FieldEditorDialog.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/NET/worlds/scape/FieldEditorDialog.java b/NET/worlds/scape/FieldEditorDialog.java new file mode 100644 index 0000000..04e496c --- /dev/null +++ b/NET/worlds/scape/FieldEditorDialog.java @@ -0,0 +1,47 @@ +package NET.worlds.scape; + +import NET.worlds.console.Console; +import NET.worlds.console.OkCancelDialog; +import java.awt.Font; +import java.awt.GridBagConstraints; +import java.awt.TextField; + +public abstract class FieldEditorDialog extends OkCancelDialog { + private TextField strField = new TextField(40); + protected EditTile parent; + private static Font font = new Font(Console.message("GammaTextFont"), 0, 12); + + protected FieldEditorDialog(EditTile parent, String title) { + super(Console.getFrame(), parent, title); + this.parent = parent; + } + + @Override + protected void build() { + GridBagConstraints c = new GridBagConstraints(); + c.fill = 2; + c.weightx = 1.0; + c.weighty = 1.0; + c.gridwidth = 0; + this.strField.setFont(font); + this.add(this.gbag, this.strField, c); + super.build(); + } + + protected abstract String getValue(); + + protected abstract boolean setValue(String var1); + + @Override + protected boolean setValue() { + return this.setValue(this.strField.getText().trim()); + } + + @Override + public void show() { + super.show(); + this.strField.setText(this.getValue()); + this.strField.requestFocus(); + this.strField.selectAll(); + } +} |