From c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 12 Feb 2026 22:33:32 -0800 Subject: Initial commit --- NET/worlds/console/BootDialog.java | 83 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 NET/worlds/console/BootDialog.java (limited to 'NET/worlds/console/BootDialog.java') diff --git a/NET/worlds/console/BootDialog.java b/NET/worlds/console/BootDialog.java new file mode 100644 index 0000000..e37de7d --- /dev/null +++ b/NET/worlds/console/BootDialog.java @@ -0,0 +1,83 @@ +package NET.worlds.console; + +import java.awt.Button; +import java.awt.Event; +import java.awt.Font; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Label; +import java.awt.Panel; +import java.awt.TextField; + +public class BootDialog extends PolledDialog { + private static final long serialVersionUID = -4574101262059937239L; + private Label bootLabel = new Label(Console.message("User-to-Boot")); + private Button okButton = new Button(Console.message("OK")); + private Button cancelButton = new Button(Console.message("Cancel")); + private static Font font = new Font(Console.message("MenuFont"), 0, 12); + private static Font bfont = new Font(Console.message("ButtonFont"), 0, 12); + private TextField bootField = new TextField(""); + + public BootDialog(java.awt.Window parent, DialogReceiver receiver, String title) { + super(parent, receiver, title, true); + this.ready(); + } + + public String getBoot() { + return this.bootField.getText(); + } + + @Override + protected void build() { + GridBagLayout gbag = new GridBagLayout(); + this.setLayout(gbag); + GridBagConstraints c = new GridBagConstraints(); + c.weightx = 1.0; + c.weighty = 1.0; + c.gridheight = 1; + c.fill = 0; + c.gridwidth = 2; + this.add(gbag, this.bootLabel, c); + c.gridwidth = 0; + c.fill = 2; + this.bootField.setFont(font); + this.add(gbag, this.bootField, c); + Panel buttons = new Panel(); + this.okButton.setFont(bfont); + buttons.add(this.okButton); + this.cancelButton.setFont(bfont); + buttons.add(this.cancelButton); + c.gridwidth = 0; + c.fill = 0; + this.add(gbag, buttons, c); + } + + @Override + public void show() { + this.initialSize(320, 140); + super.show(); + this.bootField.requestFocus(); + } + + @Override + public boolean handleEvent(Event event) { + return event.id == 201 ? this.done(false) : super.handleEvent(event); + } + + @Override + public boolean action(Event event, Object what) { + Object target = event.target; + if (target == this.cancelButton) { + this.done(false); + } else if (target == this.okButton) { + this.done(true); + } + + return false; + } + + @Override + public boolean keyDown(Event event, int key) { + return key == 27 ? this.done(false) : super.keyDown(event, key); + } +} -- cgit v1.2.3