Exemplo n.º 1
0
  public babylonServerShutdownDialog(babylonServerWindow serverWindow, babylonServer theServer) {
    super(serverWindow, theServer.strings.get(babylonServerWindow.class, "servershutdown"), true);
    parentWindow = serverWindow;
    server = theServer;

    myLayout = new GridBagLayout();
    setLayout(myLayout);

    p = new Panel();
    p.setLayout(myLayout);

    message1 = new Label(server.strings.get(babylonServerWindow.class, "areyousure1"));
    p.add(
        message1,
        new babylonConstraints(
            0,
            0,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 0),
            0,
            0));

    message2 = new Label(server.strings.get(babylonServerWindow.class, "areyousure2"));
    p.add(
        message2,
        new babylonConstraints(
            0,
            1,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 0),
            0,
            0));

    yes = new Button(server.strings.get(babylonServerWindow.class, "yes"));
    yes.addKeyListener(this);
    yes.addActionListener(this);
    p.add(
        yes,
        new babylonConstraints(
            0,
            2,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 0),
            0,
            0));

    cancel = new Button(server.strings.get("cancel"));
    cancel.addKeyListener(this);
    cancel.addActionListener(this);
    p.add(
        cancel,
        new babylonConstraints(
            1,
            2,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 0),
            0,
            0));

    add(
        p,
        new babylonConstraints(
            0,
            0,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));

    setBackground(Color.lightGray);
    pack();
    setResizable(false);
    parentWindow.centerDialog(this);

    addKeyListener(this);
    addWindowListener(this);
    setVisible(true);
    yes.requestFocus();
  }
Exemplo n.º 2
0
  public babylonTextDialog(
      Frame parent,
      String myLabel,
      String contents,
      int columns,
      int rows,
      int scrollbars,
      boolean IsModal,
      String dismissString) {
    super(parent, myLabel, IsModal);

    parentFrame = parent;

    myLayout = new GridBagLayout();
    setLayout(myLayout);

    p = new Panel();
    p.setLayout(myLayout);

    textArea = new TextArea(contents, rows, columns, scrollbars);
    textArea.addKeyListener(this);
    textArea.setEditable(false);
    textArea.setFont(babylonPanel.smallFont);
    p.add(
        textArea,
        new babylonConstraints(
            0,
            0,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 0),
            0,
            0));

    dismissButton = new Button(dismissString);
    dismissButton.setFont(babylonPanel.smallFont);
    dismissButton.addActionListener(this);
    dismissButton.addKeyListener(this);
    p.add(
        dismissButton,
        new babylonConstraints(
            0,
            1,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 0),
            0,
            0));

    add(
        p,
        new babylonConstraints(
            0,
            0,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH,
            new Insets(5, 5, 5, 5),
            0,
            0));

    pack();

    if ((parentFrame instanceof babylonWindow) || (parentFrame instanceof babylonServerWindow))
      babylonPanel.centerDialog(parentFrame, this);
    else babylonPanel.centerDialogOnScreen(this);

    addKeyListener(this);
    addWindowListener(this);
    setResizable(false);
    setVisible(true);
    dismissButton.requestFocus();
  }