summaryrefslogtreecommitdiff
path: root/NET/worlds/console/ChannelDialog.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/console/ChannelDialog.java
downloadworldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz
worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip
Initial commit
Diffstat (limited to 'NET/worlds/console/ChannelDialog.java')
-rw-r--r--NET/worlds/console/ChannelDialog.java84
1 files changed, 84 insertions, 0 deletions
diff --git a/NET/worlds/console/ChannelDialog.java b/NET/worlds/console/ChannelDialog.java
new file mode 100644
index 0000000..b2df8ac
--- /dev/null
+++ b/NET/worlds/console/ChannelDialog.java
@@ -0,0 +1,84 @@
+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 ChannelDialog extends PolledDialog {
+ private static final long serialVersionUID = -3677512952231237135L;
+ private Label channelLabel = new Label(Console.message("New-channel"));
+ 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 TextField channelField;
+
+ public ChannelDialog(java.awt.Window parent, DialogReceiver receiver, String title, String defChannel) {
+ super(parent, receiver, title, true);
+ this.channelField = new TextField(defChannel);
+ this.ready();
+ }
+
+ public String getChannel() {
+ return this.channelField.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.channelLabel.setFont(font);
+ this.add(gbag, this.channelLabel, c);
+ c.gridwidth = 0;
+ c.fill = 2;
+ this.channelField.setFont(font);
+ this.add(gbag, this.channelField, c);
+ Panel buttons = new Panel();
+ buttons.add(this.okButton);
+ buttons.add(this.cancelButton);
+ this.okButton.setFont(font);
+ this.cancelButton.setFont(font);
+ c.gridwidth = 0;
+ c.fill = 0;
+ this.add(gbag, buttons, c);
+ }
+
+ @Override
+ public void show() {
+ this.initialSize(320, 140);
+ super.show();
+ this.channelField.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);
+ }
+}