summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/ItemNotAvailableDialog.java
blob: c70268f601bec225dffb2496c5ee02c672910ed4 (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
package NET.worlds.scape;

import NET.worlds.console.Console;
import NET.worlds.console.DialogReceiver;
import NET.worlds.console.ImageButtons;
import NET.worlds.console.ImageButtonsCallback;
import NET.worlds.console.PolledDialog;
import java.awt.Component;
import java.awt.Rectangle;
import java.awt.Window;

public class ItemNotAvailableDialog extends PolledDialog implements ImageButtonsCallback {
   private ImageButtons ib;

   public ItemNotAvailableDialog(Window parent, DialogReceiver receiver) {
      super(parent, receiver, Console.message("Not-Available"), false);
      this.setAlignment(1);
      Rectangle[] rects = new Rectangle[]{new Rectangle(101, 22, 48, 19)};
      this.ib = new ImageButtons(Console.message("notavail.gif"), rects, this);
      this.ready();
   }

   @Override
   protected void build() {
      this.add("Center", this.ib);
   }

   @Override
   public Object imageButtonsCallback(Component who, int which) {
      this.done(false);
      return null;
   }

   @Override
   public boolean keyDown(java.awt.Event event, int key) {
      if (key == 27) {
         return this.done(false);
      } else {
         return key == 10 ? this.done(false) : super.keyDown(event, key);
      }
   }
}