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

import java.awt.GridBagConstraints;
import java.awt.Label;

public class ConfirmDialog extends OkCancelDialog {
   private static final long serialVersionUID = 2839131701328189735L;
   private String prompt;

   public ConfirmDialog(java.awt.Window parent, DialogReceiver target, String title, String prompt) {
      super(parent, target, title, Console.message("No"), Console.message("Yes"));
      this.prompt = prompt;
      this.ready();
   }

   public ConfirmDialog(java.awt.Window parent, String title, String prompt) {
      this(parent, (DialogReceiver)parent, title, prompt);
   }

   @Override
   protected void build() {
      GridBagConstraints c = new GridBagConstraints();
      c.weightx = 1.0;
      c.weighty = 1.0;
      c.gridwidth = 0;
      this.add(this.gbag, new Label(this.prompt), c);
      super.build();
   }

   @Override
   protected boolean setValue() {
      return true;
   }

   @Override
   public void show() {
      super.show();
      this.okButton.requestFocus();
   }
}