diff options
| author | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
| commit | e1e781bb2135ef78592226f1a3eaba4925702f1f (patch) | |
| tree | 8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/console/AvatarDialog.java | |
| download | worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip | |
Diffstat (limited to 'NET/worlds/console/AvatarDialog.java')
| -rw-r--r-- | NET/worlds/console/AvatarDialog.java | 210 |
1 files changed, 210 insertions, 0 deletions
diff --git a/NET/worlds/console/AvatarDialog.java b/NET/worlds/console/AvatarDialog.java new file mode 100644 index 0000000..c4069ca --- /dev/null +++ b/NET/worlds/console/AvatarDialog.java @@ -0,0 +1,210 @@ +/* */ package NET.worlds.console; +/* */ +/* */ import NET.worlds.scape.EventQueue; +/* */ import java.awt.Button; +/* */ import java.awt.Choice; +/* */ import java.awt.Color; +/* */ import java.awt.Event; +/* */ import java.awt.Font; +/* */ import java.awt.GridBagConstraints; +/* */ import java.awt.GridBagLayout; +/* */ import java.awt.GridLayout; +/* */ import java.awt.Label; +/* */ import java.awt.Panel; +/* */ import java.awt.Point; +/* */ import java.awt.Window; +/* */ import java.util.Vector; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public class AvatarDialog +/* */ extends PolledDialog +/* */ { +/* */ private static final long serialVersionUID = 8661992825430619335L; +/* 42 */ private Button okButton = new Button(Console.message("Close")); +/* */ private AvatarDialogCallback callback; +/* 44 */ private Vector<Choice> choices = new Vector(); +/* 45 */ private Vector<int[]> changes = new Vector(); +/* 46 */ private static Font font = new Font(Console.message("MenuFont"), +/* 47 */ 0, 12); +/* 48 */ private static Font bfont = new Font(Console.message("ButtonFont"), +/* 49 */ 0, 12); +/* */ +/* */ private int checkChanges; +/* */ +/* */ +/* */ public AvatarDialog(Window parent, DialogReceiver receiver, String title, AvatarDialogCallback callback) +/* */ { +/* 56 */ super(parent, receiver, title, false); +/* 57 */ this.callback = callback; +/* */ +/* 59 */ setResizable(false); +/* 60 */ setAlignment(3); +/* */ +/* 62 */ ready(); +/* */ } +/* */ +/* */ public void setChangeCheck() { +/* 66 */ this.checkChanges = 2; +/* */ } +/* */ +/* */ protected void build() +/* */ { +/* 71 */ Vector<String> headings = this.callback.getComponents(); +/* 72 */ int rows = headings.size(); +/* 73 */ Panel top = new Panel(new GridLayout(rows, 2, 2, 2)); +/* 74 */ top.setFont(font); +/* 75 */ top.setBackground(Color.black); +/* 76 */ for (int i = 0; i < rows; i++) { +/* 77 */ Label label = new Label((String)headings.elementAt(i), 2); +/* 78 */ label.setForeground(Color.white); +/* 79 */ label.setFont(font); +/* 80 */ top.add(label); +/* 81 */ Choice choice = new Choice(); +/* 82 */ choice.setForeground(Color.white); +/* 83 */ choice.setBackground(Color.black); +/* 84 */ choice.setFont(font); +/* 85 */ top.add(choice); +/* 86 */ this.choices.addElement(choice); +/* 87 */ Vector<String> items = this.callback.getChoices(i); +/* 88 */ int count = items.size(); +/* 89 */ for (int j = 0; j < count; j++) +/* 90 */ choice.add((String)items.elementAt(j)); +/* 91 */ choice.select(this.callback.getCurrentSelection(i)); +/* */ } +/* 93 */ GridBagLayout gbag = new GridBagLayout(); +/* 94 */ setLayout(gbag); +/* 95 */ GridBagConstraints c = new GridBagConstraints(); +/* 96 */ c.weightx = 1.0D; +/* 97 */ c.weighty = 1.0D; +/* 98 */ c.gridheight = rows; +/* 99 */ c.gridwidth = 0; +/* 100 */ c.fill = 0; +/* 101 */ add(gbag, top, c); +/* 102 */ Panel bottom = new Panel(); +/* 103 */ this.okButton.setFont(bfont); +/* 104 */ bottom.add(this.okButton); +/* 105 */ bottom.setBackground(Color.black); +/* 106 */ c.gridheight = 1; +/* 107 */ c.weightx = 0.0D; +/* 108 */ c.weighty = 0.0D; +/* 109 */ c.fill = 1; +/* 110 */ add(gbag, bottom, c); +/* 111 */ this.okButton.setBackground(Color.black); +/* 112 */ this.okButton.setForeground(Color.white); +/* */ } +/* */ +/* */ @Deprecated +/* */ public boolean handleEvent(Event event) +/* */ { +/* 118 */ if (EventQueue.redirectDrivingKeys(event)) { +/* 119 */ return true; +/* */ } +/* 121 */ if (event.id == 201) +/* 122 */ return done(false); +/* 123 */ return super.handleEvent(event); +/* */ } +/* */ +/* */ @Deprecated +/* */ public boolean action(Event event, Object what) +/* */ { +/* 129 */ Object target = event.target; +/* 130 */ if (target == this.okButton) { +/* 131 */ return done(true); +/* */ } +/* 133 */ int count = this.choices.size(); +/* 134 */ for (int i = 0; i < count; i++) { +/* 135 */ Choice choice = (Choice)this.choices.elementAt(i); +/* 136 */ if (target == choice) { +/* 137 */ int[] change = new int[2]; +/* 138 */ change[0] = i; +/* 139 */ change[1] = choice.getSelectedIndex(); +/* 140 */ this.changes.addElement(change); +/* 141 */ return true; +/* */ } +/* */ } +/* */ +/* 145 */ return false; +/* */ } +/* */ +/* */ +/* 149 */ static Point lastWindowLocation = null; +/* */ +/* */ public boolean done(boolean confirmed) +/* */ { +/* 153 */ lastWindowLocation = getLocation(); +/* 154 */ return super.done(confirmed); +/* */ } +/* */ +/* */ public void closeWin() { +/* 158 */ if (lastWindowLocation == null) { +/* 159 */ done(true); +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ protected void initialSize(int width, int height) +/* */ { +/* 168 */ if (lastWindowLocation == null) { +/* 169 */ super.initialSize(width, height); +/* */ } else { +/* 171 */ setLocation(lastWindowLocation); +/* 172 */ lastWindowLocation = null; +/* 173 */ setSize(width, height); +/* */ } +/* */ } +/* */ +/* */ protected void activeCallback() +/* */ { +/* 179 */ if ((this.checkChanges > 0) && +/* 180 */ (--this.checkChanges == 0)) { +/* 181 */ for (int i = 0; i < this.choices.size(); i++) { +/* 182 */ ((Choice)this.choices.elementAt(i)).select(this.callback +/* 183 */ .getCurrentSelection(i)); +/* */ } +/* */ } +/* 186 */ while (this.changes.size() != 0) { +/* 187 */ int[] change = (int[])this.changes.elementAt(0); +/* */ +/* 189 */ this.callback.setCurrentSelection(change[0], change[1]); +/* */ +/* 191 */ this.checkChanges = 1; +/* */ +/* 193 */ this.changes.removeElementAt(0); +/* */ } +/* */ } +/* */ +/* */ @Deprecated +/* */ public boolean keyDown(Event event, int key) +/* */ { +/* 200 */ if (key == 27) +/* 201 */ return done(false); +/* 202 */ return super.keyDown(event, key); +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\AvatarDialog.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |