Package de.matthiasmann.twl

Examples of de.matthiasmann.twl.Label


    return this.rootPane;
  }

  private Label createAndAddResourceLabel(String title, int width,
      String theme) {
    Label l;
    if (title == null) {
      l = new Label();
    } else {
      l = new Label(title);
    }
    l.setVisible(false);
    l.setSize(width, 15);
    l.setTheme(theme);
    this.rootPane.add(l);
    return l;
  }
View Full Code Here


        y = oy + 25;

        // Currently in store
        String temp = inStore.setScale(0, BigDecimal.ROUND_FLOOR)
            .toString();
        Label current = this.inStoreLabels.get(r);
        drawResourceData(g, x + padding, y + 2, temp, current);
        y += padd;

        // Modifiers
        builder.setLength(0);
        modifier = modifiers.get(r);
        if (modifier.signum() == -1) {
          // Negative value
          builder.append("-");
        } else if (modifier.signum() == 1) {
          // Positive value
          builder.append("+");
        }
        builder.append(modifier);
        Label modifierLabel = this.modifiersLabels.get(r);
        drawResourceData(g, x + padding, y + 2, modifier.toString(),
            modifierLabel);
        y += padd;

        // Available space
        Label availableLabel = this.availableSpaceLabels.get(r);
        drawResourceData(g, x + padding, y + 2,
            String.valueOf(availableSpace), availableLabel);
        y += padd;

        // Max
        temp = max.toString();
        Label maxLabel = this.maxStoreLabels.get(r);
        drawResourceData(g, x + padding, y + 2, temp, maxLabel);
      }

      x += pitch;
    }
View Full Code Here

    int x = ox + pitchX;
    int y = oy;

    // Columns labels
    for (int col = 0; col < 3; col++) {
      Label lbl = this.buildingColLabels[col];
      lbl.setVisible(true);
      lbl.setPosition(x, y);
      x += pitchX;
    }

    y += 25;
    x = startX;

    BuildingData data = BuildingIO.getBuildingData(this.selectedBuilding
        .getType());
    BuildingLevelData levelData = data.getLevelData(this.selectedBuilding
        .getLevel());
    Map<Resource, BigDecimal> prod = levelData.getProduction();
    Map<Resource, BigDecimal> cons = levelData.getConsumption();
    Map<Resource, BigDecimal> store = levelData.getStoreCapacity();
    Resource[] resources = Resource.values();
    for (Resource r : resources) {
      // TODO Row label
      Label rowLabel = this.buildingRowLabels.get(r);
      rowLabel.setVisible(true);
      rowLabel.setPosition(x, y);
      x += pitchX;

      // Production
      Label prodLabel = this.buildingProdLabels.get(r);
      String prodValue = prod.get(r).toString();
      drawResourceData(g, x, y, prodValue, prodLabel);

      // Consumption
      Label consLabel = this.buildingConsLabels.get(r);
      String consValue = cons.get(r).toString();
      drawResourceData(g, x += pitchX, y, consValue, consLabel);

      // Store provided
      Label storeLabel = this.buildingStoreLabels.get(r);
      String storeValue = store.get(r).toString();
      drawResourceData(g, x += pitchX, y, storeValue, storeLabel);

      y += pitchY;
      x = startX;
View Full Code Here

      UIHelper.drawDarkBox(g, x, y += 3, 24, 20);
      img = ImageManager.getGfx(r.getGfxBase() + "-small");
      img.draw(x + 3, y, r.getColor());

      String value = costMap.get(r).toString();
      Label lbl = this.upgradeLabels.get(r);
      drawResourceData(g, x + 24, y, value, lbl);

      y += 20;
    }
  }
View Full Code Here

      UIHelper.drawDarkBox(g, x, y += 3, 24, 20);
      img = ImageManager.getGfx(r.getGfxBase() + "-small");
      img.draw(x + 3, y, r.getColor());

      String value = resourceMap.get(r).toString();
      Label lbl = this.storeLabels.get(r);

      final int zoneHeight = 15;
      UIHelper.drawDarkBox(g, x + 24, y, lbl.getWidth() + 4, zoneHeight);
      lbl.setPosition(x + 24, y);
      lbl.setText(value);
      lbl.setVisible(true);

      x += lbl.getWidth() + 15;
      String costValue = "";
      if (costMap != null) {
        costValue = costMap.get(r).toString();
      }
      Label costLbl = this.costLabels.get(r);

      UIHelper.drawDarkBox(g, x + 24, y, costLbl.getWidth() + 4,
          zoneHeight);
      costLbl.setPosition(x + 24, y);
      costLbl.setText(costValue);
      costLbl.setVisible(true);

      y += 20;
      x = rsx;
    }
View Full Code Here

    parent.add(descLabel);

    costLabels = new HashMap<Resource, Label>();
    earnLabels = new HashMap<Resource, Label>();
    for (Resource r : Resource.values()) {
      Label lc = new Label();
      lc.setTheme("resourceLabel");
      lc.setSize(80, 15);
      parent.add(lc);
      costLabels.put(r, lc);

      Label le = new Label();
      le.setTheme("resourceLabel");
      le.setSize(80, 15);
      parent.add(le);
      earnLabels.put(r, le);
    }

    costLabel = new Label(I18n.get("global.cost"));
    costLabel.setSize(width / 2, 20);
    costLabel.setVisible(false);
    costLabel.setTheme("resourceLabel");
    parent.add(costLabel);

    earnLabel = new Label(I18n.get("global.income"));
    earnLabel.setVisible(false);
    earnLabel.setSize(width / 2, 20);
    earnLabel.setTheme("resourceLabel");
    parent.add(earnLabel);
View Full Code Here

      String costValue = "";
      if (costMap != null) {
        costValue = costMap.get(r).toString();
      }
      Label lbl = this.costLabels.get(r);

      final int zoneHeight = 15;
      UIHelper.drawDarkBox(g, x + 24, y, lbl.getWidth() + 4, zoneHeight);
      lbl.setPosition(x + 24, y);
      lbl.setText(costValue);
      lbl.setVisible(true);

      x += lbl.getWidth() + 15;
      String earnValue = "";
      if (costMap != null) {
        earnValue = earnMap.get(r).toString();
      }
      Label costLbl = this.earnLabels.get(r);

      UIHelper.drawDarkBox(g, x + 24, y, costLbl.getWidth() + 4,
          zoneHeight);
      costLbl.setPosition(x + 24, y);
      costLbl.setText(earnValue);
      costLbl.setVisible(true);

      y += 20;
      x = sx;
    }
  }
View Full Code Here

    this.x = x;
    this.y = y;
    int dx = x + 5 + 3 + 24;
    int dy = y + 5 + 3;
    for (Resource r : Resource.values()) {
      Label l = new Label();
      l.setTheme("resourceLabel");
      l.setSize(80, 15);
      l.setPosition(dx, dy);
      l.setText("0");
      twlRootPane.add(l);
      this.labels.put(r, l);
      dy += 23;
    }
View Full Code Here

    Resource[] resources = Resource.values();
    Image img;
    int dy = y + padd + 3;
    int dx = x + padd + 3;
    Label lbl;
    for (Resource r : resources) {
      UIHelper.drawDarkBox(g, dx, dy, 24, 20);
      img = ImageManager.getGfx(r.getGfxBase() + "-small");
      img.draw(dx + 3, dy, r.getColor());

      lbl = labels.get(r);
      UIHelper.drawDarkBox(g, dx + 24, dy, lbl.getWidth() + 4, 15);

      dy += 23;
    }
  }
View Full Code Here

      if (v == null) {
        value = "0";
      } else {
        value = resourceMap.get(r).toString();
      }
      Label lbl = this.labels.get(r);
      lbl.setText(value);
    }
  }
View Full Code Here

TOP

Related Classes of de.matthiasmann.twl.Label

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.