summaryrefslogtreecommitdiff
path: root/NET/worlds/console/LogMailDialog.java
blob: add59486994b35b51c1563a89059e97a6b6a23e1 (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
package NET.worlds.console;

import java.awt.GridBagConstraints;
import java.awt.TextArea;

class LogMailDialog extends OkCancelDialog {
   private static final long serialVersionUID = -6276776216084519247L;
   private TextArea commentArea;
   private String tagString;

   public LogMailDialog(DialogReceiver rcvr, String tag) {
      super(Console.getFrame(), rcvr, Console.message("Log-Mailer"), Console.message("Dont-Report"), Console.message("Report"), null, false);
      this.tagString = tag;
      this.commentArea = new TextArea("", 5, 60, 1);
      this.commentArea.setEditable(true);
      this.setConfirmKey(-1);
   }

   @Override
   protected void build() {
      GridBagConstraints c = new GridBagConstraints();
      if (this.tagString != null) {
         c.weightx = 1.0;
         c.weighty = 1.0;
         c.gridwidth = 0;
         this.add(this.gbag, new MultiLineLabel(this.tagString, 5, 5), c);
      }

      c.weightx = 1.0;
      c.weighty = 1.0;
      c.gridwidth = 0;
      this.add(this.gbag, this.commentArea, c);
      int count = 0;
      if (this.okButton != null) {
         count++;
      }

      if (this.cancelButton != null) {
         count++;
      }

      c.gridwidth = count;
      c.weightx = 1.0;
      c.weighty = 0.0;
      if (this.okButton != null) {
         this.add(this.gbag, this.okButton, c);
      }

      if (this.cancelButton != null) {
         this.add(this.gbag, this.cancelButton, c);
      }
   }

   public String getComment() {
      return this.commentArea.getText();
   }
}