Beispiel #1
0
  // ******************** Constructors **************************************
  public LinearSkin(Gauge gauge) {
    super(gauge);
    if (gauge.isAutoScale()) gauge.calcAutoScale();
    orientation = gauge.getOrientation();
    formatString =
        new StringBuilder("%.")
            .append(Integer.toString(gauge.getDecimals()))
            .append("f")
            .toString();
    tickLabelFormatString =
        new StringBuilder("%.")
            .append(Integer.toString(gauge.getTickLabelDecimals()))
            .append("f")
            .toString();
    sections = gauge.getSections();
    areas = gauge.getAreas();

    if (Orientation.VERTICAL == orientation) {
      preferredWidth = 140;
      preferredHeight = 350;
    } else {
      preferredWidth = 350;
      preferredHeight = 140;
    }
    gauge.setPrefSize(preferredWidth, preferredHeight);

    init();
    initGraphics();
    registerListeners();
  }