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(); } }