summaryrefslogtreecommitdiff
path: root/NET/worlds/console/MailDialog.java
blob: 3d9db29aa847d80ef774488bc492f418346e87eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/*     */ package NET.worlds.console;
/*     */ 
/*     */ import java.awt.Button;
/*     */ import java.awt.Component;
/*     */ import java.awt.Font;
/*     */ import java.awt.GridBagConstraints;
/*     */ import java.awt.GridBagLayout;
/*     */ import java.awt.Label;
/*     */ import java.awt.TextArea;
/*     */ import java.awt.TextField;
/*     */ import java.util.StringTokenizer;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ class MailDialog
/*     */   extends OkCancelDialog
/*     */ {
/*     */   private static final long serialVersionUID = -5118823076163262543L;
/*     */   private TextField recipientField;
/*     */   private TextField subjectField;
/*     */   private TextArea bodyTextArea;
/*  43 */   private static Font font = new Font(Console.message("ConsoleFont"), 
/*  44 */     0, 12);
/*     */   
/*     */ 
/*     */ 
/*     */   public MailDialog(Console console)
/*     */   {
/*  50 */     super(Console.getFrame(), new MailDialogReceiver(console), Console.message("Mail"), Console.message("Dont-Send"), Console.message("Send"), null, false);
/*  51 */     setConfirmKey(0);
/*  52 */     this.recipientField = new TextField();
/*  53 */     this.recipientField.setFont(font);
/*     */     
/*     */ 
/*     */ 
/*  57 */     this.subjectField = new TextField();
/*  58 */     this.subjectField.setFont(font);
/*  59 */     this.bodyTextArea = new TextArea("", 5, 50, 
/*  60 */       1);
/*  61 */     this.bodyTextArea.setEditable(true);
/*  62 */     this.bodyTextArea.setFont(font);
/*  63 */     setAlignment(1);
/*     */   }
/*     */   
/*     */   public MailDialog(Console console, String recipient)
/*     */   {
/*  68 */     this(console);
/*  69 */     this.recipientField.setText(Console.parseExtended(recipient));
/*  70 */     this.recipientField.setFont(font);
/*     */   }
/*     */   
/*     */   protected void build()
/*     */   {
/*  75 */     GridBagConstraints c = new GridBagConstraints();
/*  76 */     int line = 0;
/*     */     
/*     */ 
/*  79 */     c.fill = 0;
/*  80 */     c.anchor = 13;
/*  81 */     add(this.gbag, new Label(Console.message("To")), c, 0, line, 1, 1, 0, 0);
/*  82 */     c.fill = 2;
/*  83 */     c.anchor = 17;
/*     */     
/*  85 */     add(this.gbag, this.recipientField, c, 1, line, 3, 1, 100, 0);
/*     */     
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*  97 */     line++;
/*  98 */     c.fill = 0;
/*  99 */     c.anchor = 13;
/* 100 */     Label subjectLabel = new Label(Console.message("Subject"));
/* 101 */     subjectLabel.setFont(font);
/* 102 */     add(this.gbag, subjectLabel, c, 0, line, 1, 1, 0, 0);
/* 103 */     c.fill = 2;
/* 104 */     c.anchor = 17;
/* 105 */     add(this.gbag, this.subjectField, c, 1, line, 3, 1, 100, 0);
/*     */     
/*     */ 
/* 108 */     line++;
/* 109 */     c.anchor = 10;
/* 110 */     c.fill = 1;
/*     */     
/* 112 */     add(this.gbag, this.bodyTextArea, c, 0, line, 4, 1, 100, 100);
/*     */     
/*     */ 
/* 115 */     line++;
/* 116 */     c.fill = 0;
/* 117 */     if (this.okButton != null) {
/* 118 */       this.okButton.setFont(font);
/* 119 */       add(this.gbag, this.okButton, c, 1, line, 1, 1, 100, 0);
/*     */     }
/* 121 */     if (this.cancelButton != null) {
/* 122 */       this.cancelButton.setFont(font);
/* 123 */       add(this.gbag, this.cancelButton, c, 2, line, 1, 1, 100, 0);
/*     */     }
/*     */   }
/*     */   
/*     */ 
/*     */   private void add(GridBagLayout gbag, Component comp, GridBagConstraints cont, int x, int y, int w, int h, int wx, int wy)
/*     */   {
/* 130 */     cont.gridx = x;
/* 131 */     cont.gridy = y;
/* 132 */     cont.gridwidth = w;
/* 133 */     cont.gridheight = h;
/* 134 */     cont.weightx = wx;
/* 135 */     cont.weighty = wy;
/* 136 */     add(gbag, comp, cont);
/*     */   }
/*     */   
/*     */   public String[] getTo()
/*     */   {
/* 141 */     Console console = Console.getActive();
/* 142 */     String toLine = this.recipientField.getText();
/* 143 */     StringTokenizer tokenizer = new StringTokenizer(toLine, ",");
/* 144 */     String[] to = new String[tokenizer.countTokens()];
/* 145 */     for (int i = 0; tokenizer.hasMoreTokens(); i++) {
/* 146 */       to[i] = tokenizer.nextToken().trim();
/* 147 */       if ((to[i].indexOf("@") == -1) && (console != null))
/* 148 */         to[i] = (to[i] + "@" + console.getMailDomain());
/*     */     }
/* 150 */     return to;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public String getSubject()
/*     */   {
/* 166 */     return this.subjectField.getText();
/*     */   }
/*     */   
/*     */   public String getBody()
/*     */   {
/* 171 */     return this.bodyTextArea.getText();
/*     */   }
/*     */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\MailDialog.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */