예제 #1
0
파일: LcdSkin.java 프로젝트: jforge/Medusa
 // ******************** Constructors **************************************
 public LcdSkin(Gauge gauge) {
   super(gauge);
   width = PREFERRED_WIDTH;
   height = PREFERRED_HEIGHT;
   valueOffsetLeft = 0.0;
   valueOffsetRight = 0.0;
   digitalFontSizeFactor = 1.0;
   backgroundTextBuilder = new StringBuilder();
   valueFormatString =
       new StringBuilder("%.")
           .append(Integer.toString(gauge.getDecimals()))
           .append("f")
           .toString();
   otherFormatString =
       new StringBuilder("%.")
           .append(Integer.toString(gauge.getTickLabelDecimals()))
           .append("f")
           .toString();
   sections = gauge.getSections();
   sectionColorMap = new HashMap<>(sections.size());
   updateSectionColors();
   FOREGROUND_SHADOW.setOffsetX(0);
   FOREGROUND_SHADOW.setOffsetY(1);
   FOREGROUND_SHADOW.setColor(Color.rgb(0, 0, 0, 0.5));
   FOREGROUND_SHADOW.setBlurType(BlurType.TWO_PASS_BOX);
   FOREGROUND_SHADOW.setRadius(2);
   init();
   initGraphics();
   registerListeners();
 }
예제 #2
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();
  }