Пример #1
0
 // -------------------------------actionFormParty-----------------------------
 private void actionFormParty() {
   PartyFormDialog oPopup = new PartyFormDialog(frame);
   oPopup.show();
   oParty = oPopup.getParty();
   panParty.setParty(oParty);
   if (oParty != null) lblStatus2.setText("Party is ready!");
 }
Пример #2
0
  // --------------------------------initGUI------------------------------------
  public void initGUI() {
    bDeployed = bOpponentDeployed = false;
    listAT = new LinkedList();

    frame.setJMenuBar(new GameMenuBar(this));
    panParty = new PartyPanel(200, 480);
    panStatus = new JPanel(null);
    oMap = new Map(600, 350);
    panChat = new ChatPanel(600, 200);

    Container contentPane = frame.getContentPane();

    panParty.setOpaque(true);
    panStatus.setOpaque(true);
    panChat.setOpaque(true);

    panStatus.setPreferredSize(new Dimension(200, 70));

    contentPane.add(panStatus);
    contentPane.add(panParty);
    contentPane.add(oMap);
    contentPane.add(panChat);

    SpringLayout oLayout = new SpringLayout();
    contentPane.setLayout(oLayout);

    oLayout.putConstraint(SpringLayout.WEST, panParty, 0, SpringLayout.WEST, contentPane);
    oLayout.putConstraint(SpringLayout.NORTH, panParty, 0, SpringLayout.NORTH, contentPane);
    oLayout.putConstraint(SpringLayout.WEST, panStatus, 0, SpringLayout.WEST, contentPane);
    oLayout.putConstraint(SpringLayout.SOUTH, panStatus, 0, SpringLayout.SOUTH, contentPane);
    oLayout.putConstraint(SpringLayout.EAST, oMap, 0, SpringLayout.EAST, contentPane);
    oLayout.putConstraint(SpringLayout.NORTH, oMap, 0, SpringLayout.NORTH, contentPane);
    oLayout.putConstraint(SpringLayout.WEST, panChat, 0, SpringLayout.EAST, panStatus);
    oLayout.putConstraint(SpringLayout.NORTH, panChat, 0, SpringLayout.SOUTH, oMap);
    oLayout.putConstraint(SpringLayout.EAST, contentPane, 0, SpringLayout.EAST, panChat);
    oLayout.putConstraint(SpringLayout.SOUTH, contentPane, 0, SpringLayout.SOUTH, panChat);

    panChat.validate();
    panChat.setVisible(true);

    Insets oInsets = panStatus.getInsets();
    int nX = oInsets.left + 5;
    int nY = oInsets.top + 5;

    lblStatus1 = new JLabel("Not Connected...");
    lblStatus2 = new JLabel("No Party Formed...");
    lblStatus3 = new JLabel();

    Dimension oSize = lblStatus1.getPreferredSize();

    lblStatus1.setBounds(nX, nY, 180, oSize.height);
    nY += oSize.height + 7;
    lblStatus2.setBounds(nX, nY, 180, oSize.height);
    nY += oSize.height + 7;
    lblStatus3.setBounds(nX, nY, 180, oSize.height);

    panStatus.add(lblStatus1);
    panStatus.add(lblStatus2);
    panStatus.add(lblStatus3);

    frame.pack();
    frame.setResizable(false);
    frame.setLocation(
        ((scrBounds.x + scrBounds.width - frame.getWidth()) / 2),
        ((scrBounds.y + scrBounds.height - frame.getHeight()) / 2));

    oMap.addKeyListener(oMap);
    oMap.setButtonEvents(this);
  }