summaryrefslogtreecommitdiff
path: root/NET/worlds/console/EditNamesDialog.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-03 16:38:41 -0700
committerFuwn <[email protected]>2021-05-03 16:38:41 -0700
commite1e781bb2135ef78592226f1a3eaba4925702f1f (patch)
tree8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/console/EditNamesDialog.java
downloadworlds.jar-main.tar.xz
worlds.jar-main.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/console/EditNamesDialog.java')
-rw-r--r--NET/worlds/console/EditNamesDialog.java209
1 files changed, 209 insertions, 0 deletions
diff --git a/NET/worlds/console/EditNamesDialog.java b/NET/worlds/console/EditNamesDialog.java
new file mode 100644
index 0000000..be17e1e
--- /dev/null
+++ b/NET/worlds/console/EditNamesDialog.java
@@ -0,0 +1,209 @@
+/* */ 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.List;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ class EditNamesDialog
+/* */ extends PolledDialog
+/* */ implements DialogReceiver
+/* */ {
+/* */ private static final long serialVersionUID = -3309806087387084117L;
+/* 34 */ private List listbox = new List(10);
+/* 35 */ private Button addButton = new Button(Console.message("Add"));
+/* 36 */ private Button delButton = new Button(Console.message("Delete"));
+/* 37 */ private Button cancelButton = new Button(Console.message("Done"));
+/* */ private NameListOwner owner;
+/* */ private String addTitle;
+/* 40 */ private static Font font = new Font(Console.message("ButtonFont"),
+/* 41 */ 0, 12);
+/* */
+/* */
+/* */ EditNamesDialog(NameListOwner owner, String title, String addTitle)
+/* */ {
+/* 46 */ super(Console.getFrame(), null, title, true);
+/* */
+/* */
+/* 49 */ this.owner = owner;
+/* 50 */ this.addTitle = addTitle;
+/* 51 */ ready();
+/* */ }
+/* */
+/* */
+/* */
+/* */ protected void build()
+/* */ {
+/* 58 */ int count = this.owner.getNameListCount();
+/* 59 */ for (int i = 0; i < count; i++) {
+/* 60 */ this.listbox.add(this.owner.getNameListName(i));
+/* */ }
+/* */
+/* 63 */ GridBagLayout gbag = new GridBagLayout();
+/* 64 */ setLayout(gbag);
+/* 65 */ GridBagConstraints c = new GridBagConstraints();
+/* 66 */ c.fill = 1;
+/* 67 */ c.weightx = 1.0D;
+/* 68 */ c.weighty = 1.0D;
+/* 69 */ c.gridwidth = 2;
+/* 70 */ c.gridheight = 3;
+/* 71 */ add(gbag, this.listbox, c);
+/* 72 */ c.weightx = 0.0D;
+/* 73 */ c.weighty = 0.0D;
+/* 74 */ c.gridwidth = 0;
+/* 75 */ c.gridheight = 1;
+/* 76 */ c.fill = 2;
+/* 77 */ this.addButton.setFont(font);
+/* 78 */ this.delButton.setFont(font);
+/* 79 */ this.cancelButton.setFont(font);
+/* 80 */ add(gbag, this.addButton, c);
+/* 81 */ add(gbag, this.delButton, c);
+/* 82 */ c.weighty = 1.0D;
+/* 83 */ c.anchor = 15;
+/* 84 */ add(gbag, this.cancelButton, c);
+/* */ }
+/* */
+/* */
+/* */ private void select(boolean state)
+/* */ {
+/* 90 */ this.delButton.setEnabled(state);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public void setVisible(boolean visible)
+/* */ {
+/* 98 */ super.setVisible(visible);
+/* */
+/* 100 */ if (visible)
+/* */ {
+/* 102 */ if (this.listbox.getItemCount() != 0) {
+/* 103 */ this.listbox.select(0);
+/* 104 */ select(true);
+/* */ } else {
+/* 106 */ select(false);
+/* */ }
+/* */
+/* 109 */ this.listbox.requestFocus();
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */ @Deprecated
+/* */ public boolean handleEvent(Event event)
+/* */ {
+/* 118 */ if (event.id == 701) {
+/* 119 */ select(true);
+/* 120 */ } else if (event.id == 702) {
+/* 121 */ select(false);
+/* */ }
+/* */
+/* 124 */ return super.handleEvent(event);
+/* */ }
+/* */
+/* */
+/* */ @Deprecated
+/* */ public boolean action(Event event, Object what)
+/* */ {
+/* 131 */ Object target = event.target;
+/* */
+/* */
+/* 134 */ if (target == this.cancelButton) {
+/* 135 */ return done(false);
+/* */ }
+/* */
+/* 138 */ if (target == this.delButton) {
+/* 139 */ int index = this.listbox.getSelectedIndex();
+/* 140 */ if (index != -1)
+/* */ {
+/* */
+/* 143 */ this.listbox.remove(index);
+/* 144 */ this.owner.removeNameListName(index);
+/* */
+/* */
+/* 147 */ int count = this.listbox.getItemCount();
+/* 148 */ if (index < count - 1) {
+/* 149 */ this.listbox.select(index);
+/* 150 */ } else if (count > 0) {
+/* 151 */ this.listbox.select(count - 1);
+/* */ } else {
+/* 153 */ select(false);
+/* 154 */ this.listbox.requestFocus();
+/* */ }
+/* */ }
+/* 157 */ return true;
+/* */ }
+/* */
+/* */
+/* 161 */ if (target == this.addButton)
+/* */ {
+/* */
+/* 164 */ if (this.owner.mayAddNameListName(this))
+/* 165 */ new AddNameDialog(this, this.addTitle);
+/* 166 */ return true;
+/* */ }
+/* 168 */ return false;
+/* */ }
+/* */
+/* */
+/* */ @Deprecated
+/* */ public boolean keyDown(Event event, int key)
+/* */ {
+/* 175 */ if ((key == 27) || (key == 10))
+/* 176 */ return done(false);
+/* 177 */ return super.keyDown(event, key);
+/* */ }
+/* */
+/* */ public void dialogDone(Object who, boolean confirmed)
+/* */ {
+/* 182 */ if (confirmed)
+/* */ {
+/* */
+/* 185 */ String name =
+/* 186 */ Console.parseUnicode(((AddNameDialog)who).getName());
+/* 187 */ int pos = this.owner.addNameListName(name);
+/* */
+/* 189 */ if (pos == -1) {
+/* 190 */ return;
+/* */ }
+/* */
+/* */
+/* 194 */ if (pos == this.listbox.getItemCount()) {
+/* 195 */ this.listbox.add(name);
+/* */ }
+/* */
+/* 198 */ this.listbox.makeVisible(pos);
+/* 199 */ this.listbox.select(pos);
+/* 200 */ select(true);
+/* */ }
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\EditNamesDialog.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file