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/console/AboutDialog.java | |
| download | worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip | |
Initial commit
Diffstat (limited to 'NET/worlds/console/AboutDialog.java')
| -rw-r--r-- | NET/worlds/console/AboutDialog.java | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/NET/worlds/console/AboutDialog.java b/NET/worlds/console/AboutDialog.java new file mode 100644 index 0000000..4fea336 --- /dev/null +++ b/NET/worlds/console/AboutDialog.java @@ -0,0 +1,100 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import NET.worlds.core.Std; +import NET.worlds.network.NetUpdate; +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Color; +import java.awt.Component; +import java.awt.Event; +import java.awt.Font; +import java.awt.Frame; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Label; +import java.awt.Panel; +import java.awt.TextArea; +import java.util.Enumeration; +import java.util.Vector; + +public class AboutDialog extends PolledDialog { + private static final long serialVersionUID = -2810306367601133331L; + public static final String JavaVersion = "1890a40"; + Button okButton = new Button(Console.message("OK")); + private static Font font = new Font(Console.message("ConsoleFont"), 0, 12); + private static Font bfont = new Font(Console.message("ButtonFont"), 0, 12); + String apptitle; + + AboutDialog(String apptitle, Frame frame) { + super(frame, null, Console.message("About") + Std.getProductName(), true); + this.apptitle = apptitle; + this.ready(); + } + + private Component setConstraints(GridBagLayout gbag, Component comp, GridBagConstraints c) { + gbag.setConstraints(comp, c); + return comp; + } + + @Override + protected void build() { + this.setBackground(Color.white); + this.setLayout(new BorderLayout()); + this.add("North", new Filler(10, 10)); + this.add("South", new Filler(10, 10)); + this.add("East", new Filler(10, 10)); + this.add("West", new Filler(10, 10)); + GridBagLayout gbag = new GridBagLayout(); + Panel p = new Panel(gbag); + p.setFont(font); + GridBagConstraints c = new GridBagConstraints(); + c.fill = 0; + c.weightx = 1.0; + c.weighty = 1.0; + c.gridwidth = 0; + c.gridheight = 1; + String logo = IniFile.override().getIniString("AboutLogo", Console.message("wlogo.gif")); + p.add(this.setConstraints(gbag, new ImageCanvas(logo), c)); + c.weightx = 0.0; + c.weighty = 0.0; + p.add(this.setConstraints(gbag, new Label(this.apptitle), c)); + if (Gamma.getShaper() != null) { + p.add(this.setConstraints(gbag, new Label(Console.message("about-box-build-date") + " " + Std.getBuildInfo() + ":" + "1890a40"), c)); + } else { + p.add(this.setConstraints(gbag, new Label(Console.message("about-box-rev") + " " + Std.getVersion() + " : " + "1890a40"), c)); + } + + Vector<String> worlds = NetUpdate.aboutWorlds(); + TextArea worldList = new TextArea(10, 40); + worldList.setEditable(false); + p.add(this.setConstraints(gbag, worldList, c)); + Enumeration<String> e = worlds.elements(); + + while (e.hasMoreElements()) { + worldList.append(e.nextElement() + "\n"); + } + + p.add(this.setConstraints(gbag, new Label(Console.message("about-box-1")), c)); + p.add(this.setConstraints(gbag, new Label(Console.message("about-box-2")), c)); + this.okButton.setFont(bfont); + p.add(this.setConstraints(gbag, this.okButton, c)); + this.add("Center", p); + } + + @Override + public boolean action(Event event, Object what) { + return event.target == this.okButton ? this.done(true) : false; + } + + @Override + public boolean keyDown(Event event, int key) { + return key != 27 && key != 10 ? super.keyDown(event, key) : this.done(true); + } + + @Override + public void show() { + super.show(); + this.okButton.requestFocus(); + } +} |