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

import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Dialog;
import java.awt.Event;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Panel;
import java.text.DateFormat;
import java.util.Date;

class ExpireDialog extends Dialog {
   private static final long serialVersionUID = -1622362025617429254L;
   protected Button button;
   private static Font font = new Font(Console.message("ButtonFont"), 0, 12);

   public ExpireDialog(Date expireDate) {
      super((Dialog)null, GammaFrame.getDefaultTitle(), false);
      this.setLayout(new BorderLayout(15, 15));
      this.add("Center", new MultiLineLabel(Console.message("beta-expired") + DateFormat.getDateTimeInstance().format(expireDate), 20, 20));
      this.button = new Button(Console.message("OK"));
      this.button.setFont(font);
      Panel p = new Panel();
      p.setLayout(new FlowLayout(1, 15, 15));
      p.add(this.button);
      this.add("South", p);
      this.pack();
   }

   @Override
   public boolean action(Event e, Object arg) {
      if (e.target == this.button) {
         this.hide();
         this.dispose();
         Main.end();
         return true;
      } else {
         return false;
      }
   }

   @Override
   public boolean gotFocus(Event e, Object arg) {
      this.button.requestFocus();
      return true;
   }
}