コード例 #1
0
  /** Set the Labels */
  protected void setLabels() {
    mLabels = new HashMap<String, Label>();
    mValues = new HashMap<String, Label>();

    for (String name : mLabelNames) {
      Label newLabel1 = new Label(name);
      Label newLabel2 = new Label();
      newLabel1.setFont(new Font("Arial", 20));
      newLabel2.setFont(new Font("Arial", 20));
      mLabels.put(name, newLabel1);
      mValues.put(name, newLabel2);
    }

    Label upgradeLabel = new Label(mUpgradeName);
    upgradeLabel.setFont(new Font("Arial", 25));
    upgradeLabel.setWrapText(true);
    mLabels.put(mUpgradeName, upgradeLabel);

    update();
  }
コード例 #2
0
 /** Updater */
 protected void update() {
   mValues
       .get("Plants in Operation")
       .setText("" + mModel.getEnergyManager().getFossil().getAmount());
   mValues
       .get("Supply Provided")
       .setText(String.format(FORMAT, mModel.getEnergyManager().getFossil().getPower()));
   mValues
       .get("Cost")
       .setText(String.format(FORMAT, mModel.getEnergyManager().getFossil().getCostBuild()));
   mValues
       .get("Public Approval")
       .setText(String.format(FORMAT, mModel.getEnergyManager().getFossil().getApproval()));
   mValues
       .get("Emissions")
       .setText(String.format(FORMAT, mModel.getEnergyManager().getFossil().getEmissions()));
   mValues
       .get("Security")
       .setText(String.format(FORMAT, mModel.getEnergyManager().getFossil().getSecurity()));
   mValues
       .get("Profit")
       .setText(String.format(FORMAT, mModel.getEnergyManager().getFossil().getProfit()));
 }
コード例 #3
0
  /** Setup of the Pane */
  protected void setup() {
    setLabels();
    add(getTitleLabel(), 0, 0, 7, 1);
    add(mApply, 0, 3, 7, 1);
    add(mFossilUpgrades, 1, 12, 1, 1);
    add(mUp, 5, 1, 1, 1);
    add(mDown, 5, 2, 1, 1);

    add(mLabels.get("Plants in Operation"), 1, 1, 4, 2);
    add(mLabels.get("Supply Provided"), 1, 4, 3, 1);
    add(mLabels.get("Cost"), 1, 5, 3, 1);
    add(mLabels.get("Public Approval"), 1, 6, 3, 1);
    add(mLabels.get("Emissions"), 1, 8, 3, 1);
    add(mLabels.get("Security"), 1, 9, 3, 1);
    add(mLabels.get("Profit"), 1, 10, 3, 1);
    add(mLabels.get(mUpgradeName), 3, 12, 3, 1);

    add(mValues.get("Plants in Operation"), 4, 1, 1, 2);
    add(mValues.get("Supply Provided"), 5, 4, 1, 1);
    add(mValues.get("Cost"), 5, 5, 1, 1);
    add(mValues.get("Public Approval"), 5, 6, 1, 1);
    add(mValues.get("Emissions"), 5, 8, 1, 1);
    add(mValues.get("Security"), 5, 9, 1, 1);
    add(mValues.get("Profit"), 5, 10, 1, 1);
  }