Ejemplo n.º 1
0
  public LandMarkBottom(GamePanel tempgp, LandMarkTop templmt, LandMark templm) {

    gp = tempgp;
    lmt = templmt;

    lm = templm;

    setPreferredSize(new Dimension(500, 75));
    setBackground(Color.BLACK);
    setLayout(null);

    btnParty.setBounds(0, 0, 100, 75);
    btnParty.addActionListener(new HandleBtnParty());
    add(btnParty);

    btnSupplies.setBounds(100, 0, 100, 75);
    btnSupplies.addActionListener(new HandleBtnSupplies());
    btnSupplies.setFont(new Font("Lucida Sans Typewriter", Font.PLAIN, 14));
    add(btnSupplies);

    btnStore.setBounds(200, 0, 100, 75);
    btnStore.addActionListener(new HandleBtnStore());
    add(btnStore);

    btnLeave.setBounds(400, 0, 100, 75);
    btnLeave.addActionListener(new HandleBtnLeave());
    add(btnLeave);
  }
  public BottomOverWorld(OverWorld tempow, GamePanel tempgp) {

    gp = tempgp;
    playersname = GamePanel.playersname;

    timer = new javax.swing.Timer(200, new TimerListener());
    timer.start();

    numFuel = GamePanel.numFuel;
    numFood = GamePanel.numFood;
    numFlashDrives = GamePanel.numFlashDrives;
    numMoney = GamePanel.numMoney;
    numTires = GamePanel.numTires;
    numMufflers = GamePanel.numMufflers;

    lblPlayerName.setText(GamePanel.playersname);
    lblFuelNum.setText("" + numFuel);
    lblFoodNum.setText("" + numFood);
    lblFlashDrivesNum.setText("" + numFlashDrives);
    lblMoneyNum.setText("" + numMoney);
    lblTiresNum.setText("" + numTires);
    lblMufflersNum.setText("" + numMufflers);
    lblNextLandmarkNum.setText("" + numNextLandMark);

    setLayout(new BorderLayout());

    setBackground(new Color(0xd2b48c));

    btnHealth.setPreferredSize(new Dimension(150, getHeight() / 3));
    btnStats.setPreferredSize(new Dimension(150, getHeight() / 3));
    btnStop.setPreferredSize(new Dimension(150, getHeight() / 3));

    btnHealth.addActionListener(new HandleBtnHealth());
    btnStats.addActionListener(new HandleBtnStats());
    btnStop.addActionListener(new HandleBtnStop());

    JPanel btnPanel = new JPanel();
    btnPanel.setLayout(new GridLayout(3, 1));
    btnPanel.add(btnHealth);
    btnPanel.add(btnStats);
    btnPanel.add(btnStop);

    add(btnPanel, BorderLayout.EAST);

    listHealthLabels.add(lblPlayerName);
    listHealthLabels.add(lblPlayerHealth);
    listHealthLabels.add(lblMrSawyerName);
    listHealthLabels.add(lblMrSawyerHealth);
    listHealthLabels.add(lblVikrantName);
    listHealthLabels.add(lblVikrantHealth);
    listHealthLabels.add(lblVarunName);
    listHealthLabels.add(lblVarunHealth);
    listHealthLabels.add(lblBrianName);
    listHealthLabels.add(lblBrianHealth);
    for (int i = 0; i < 10; i++) {
      listHealthLabels.get(i).setOpaque(true);
      listHealthLabels.get(i).setBackground(new Color(0xd2b48c));
    }

    listStatsLabels.add(lblFuelName);
    listStatsLabels.add(lblFuelNum);
    listStatsLabels.add(lblFoodName);
    listStatsLabels.add(lblFoodNum);
    listStatsLabels.add(lblFlashDrivesName);
    listStatsLabels.add(lblFlashDrivesNum);
    listStatsLabels.add(lblMoneyName);
    listStatsLabels.add(lblMoneyNum);
    listStatsLabels.add(lblTiresName);
    listStatsLabels.add(lblTiresNum);
    listStatsLabels.add(lblMufflersName);
    listStatsLabels.add(lblMufflersNum);
    listStatsLabels.add(lblNextLandmarkName);
    listStatsLabels.add(lblNextLandmarkNum);
    for (int i = 0; i < listStatsLabels.size(); i++) {
      listStatsLabels.get(i).setOpaque(true);
      listStatsLabels.get(i).setBackground(new Color(0xd2b48c));
    }

    updateHud();
  }