コード例 #1
0
ファイル: PathSample.java プロジェクト: TriMontana/douggithub
 // REMOVE ME
 public static Node createIconContent() {
   Path path = new Path();
   path.getElements()
       .addAll(new MoveTo(25, 25), new HLineTo(45), new ArcTo(20, 20, 0, 80, 25, true, true));
   path.setStroke(Color.web("#b9c0c5"));
   path.setStrokeWidth(5);
   path.getStrokeDashArray().addAll(15d, 15d);
   path.setFill(null);
   javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow();
   effect.setOffsetX(1);
   effect.setOffsetY(1);
   effect.setRadius(3);
   effect.setColor(Color.rgb(0, 0, 0, 0.6));
   path.setEffect(effect);
   return path;
 }
コード例 #2
0
ファイル: InventoryExample.java プロジェクト: eckountl/JavaFX
  public VBox drawSlot(int width, int height, Color color) {

    VBox box = new VBox();
    box.setEffect(new DropShadow());

    Rectangle rect = new Rectangle();

    // Size
    rect.setWidth(50);
    rect.setHeight(50);

    // Properties
    rect.setFill(color);
    rect.setOpacity(1.0);

    box.getChildren().add(rect);

    box.setOnMouseEntered(
        event -> {
          InnerShadow is = new InnerShadow();
          is.setChoke(1.0);
          is.setRadius(5);
          is.setColor(Color.BLACK);

          // ((VBox)event.getSource()).setEffect(is);
          ((Rectangle) ((VBox) event.getSource()).getChildren().get(0)).setEffect(is);
        });

    box.setOnMouseExited(
        event -> {
          // ((VBox)event.getSource()).setEffect(null);
          ((Rectangle) ((VBox) event.getSource()).getChildren().get(0)).setEffect(null);
        });

    return box;
  }
コード例 #3
0
ファイル: LcdSkin.java プロジェクト: jforge/Medusa
  private void resize() {
    width =
        getSkinnable().getWidth()
            - getSkinnable().getInsets().getLeft()
            - getSkinnable().getInsets().getRight();
    height =
        getSkinnable().getHeight()
            - getSkinnable().getInsets().getTop()
            - getSkinnable().getInsets().getBottom();

    if (aspectRatio * width > height) {
      width = 1 / (aspectRatio / height);
    } else if (1 / (aspectRatio / height) > width) {
      height = aspectRatio * width;
    }

    if (width > 0 && height > 0) {
      pane.setMaxSize(width, height);
      pane.relocate(
          (getSkinnable().getWidth() - width) * 0.5, (getSkinnable().getHeight() - height) * 0.5);

      updateLcdDesign(height);

      mainInnerShadow0.setRadius(0.0625 * height);
      mainInnerShadow1.setRadius(0.04166667 * height);

      if (crystalOverlay.isVisible()) {
        crystalClip.setWidth(width);
        crystalClip.setHeight(height);
        crystalOverlay.setImage(
            Helper.createNoiseImage(width, height, DARK_NOISE_COLOR, BRIGHT_NOISE_COLOR, 8));
        crystalOverlay.setCache(true);
      }

      double tSize = 0.2 * height;
      threshold.getElements().clear();
      threshold.getElements().add(new MoveTo(0.41666667 * tSize, 0.75 * tSize));
      threshold.getElements().add(new LineTo(0.583333333333333 * tSize, 0.75 * tSize));
      threshold.getElements().add(new LineTo(0.583333333333333 * tSize, 0.916666666666667 * tSize));
      threshold.getElements().add(new LineTo(0.416666666666667 * tSize, 0.916666666666667 * tSize));
      threshold.getElements().add(new LineTo(0.416666666666667 * tSize, 0.75 * tSize));
      threshold.getElements().add(new ClosePath());
      threshold.getElements().add(new MoveTo(0.416666666666667 * tSize, 0.333333333333333 * tSize));
      threshold.getElements().add(new LineTo(0.583333333333333 * tSize, 0.333333333333333 * tSize));
      threshold.getElements().add(new LineTo(0.583333333333333 * tSize, 0.666666666666667 * tSize));
      threshold.getElements().add(new LineTo(0.416666666666667 * tSize, 0.666666666666667 * tSize));
      threshold.getElements().add(new LineTo(0.416666666666667 * tSize, 0.333333333333333 * tSize));
      threshold.getElements().add(new ClosePath());
      threshold.getElements().add(new MoveTo(tSize, tSize));
      threshold.getElements().add(new LineTo(0.5 * tSize, 0));
      threshold.getElements().add(new LineTo(0, tSize));
      threshold.getElements().add(new LineTo(tSize, tSize));
      threshold.getElements().add(new ClosePath());
      threshold.relocate(0.027961994662429348 * width, 0.75 * height - 2);

      updateFonts();

      // Setup the lcd unit
      unitText.setFont(unitFont);
      unitText.setTextOrigin(VPos.BASELINE);
      unitText.setTextAlignment(TextAlignment.RIGHT);

      unitText.setText(getSkinnable().getUnit());
      if (unitText.visibleProperty().isBound()) {
        unitText.visibleProperty().unbind();
      }

      valueOffsetLeft = height * 0.04;

      if (getSkinnable().getUnit().isEmpty()) {
        valueOffsetRight = height * 0.0833333333;
        valueText.setX((width - valueText.getLayoutBounds().getWidth()) - valueOffsetRight);
      } else {
        unitText.setX((width - unitText.getLayoutBounds().getWidth()) - height * 0.04);
        unitText.setY(
            height - (valueText.getLayoutBounds().getHeight() * digitalFontSizeFactor) * 0.5);
        valueOffsetRight =
            (unitText.getLayoutBounds().getWidth()
                + height * 0.0833333333); // distance between value and unit
        valueText.setX(width - 2 - valueText.getLayoutBounds().getWidth() - valueOffsetRight);
      }
      valueText.setY(
          height - (valueText.getLayoutBounds().getHeight() * digitalFontSizeFactor) * 0.5);

      // Visualize the lcd semitransparent background text
      updateBackgroundText();

      if (getSkinnable().getUnit().isEmpty()) {
        backgroundText.setX(
            (width - backgroundText.getLayoutBounds().getWidth()) - valueOffsetRight);
      } else {
        backgroundText.setX(
            width - 2 - backgroundText.getLayoutBounds().getWidth() - valueOffsetRight);
      }
      backgroundText.setY(
          height - (backgroundText.getLayoutBounds().getHeight() * digitalFontSizeFactor) * 0.5);

      // Setup the font for the lcd title, number system, min measured, max measure and former value
      // Title
      title.setFont(titleFont);
      title.setTextOrigin(VPos.BASELINE);
      title.setTextAlignment(TextAlignment.CENTER);
      title.setText(getSkinnable().getTitle());
      title.setX((width - title.getLayoutBounds().getWidth()) * 0.5);
      title.setY(
          pane.getLayoutBounds().getMinY()
              + title.getLayoutBounds().getHeight()
              - 0.04 * height
              + 4);

      // Info Text
      lowerRightText.setFont(smallFont);
      lowerRightText.setTextOrigin(VPos.BASELINE);
      lowerRightText.setTextAlignment(TextAlignment.RIGHT);
      lowerRightText.setText(getSkinnable().getSubTitle());
      lowerRightText.setX(
          pane.getLayoutBounds().getMinX()
              + (pane.getLayoutBounds().getWidth() - lowerRightText.getLayoutBounds().getWidth())
                  * 0.5);
      lowerRightText.setY(pane.getLayoutBounds().getMinY() + height - 4 - 0.0416666667 * height);

      // Min measured value
      upperLeftText.setFont(smallFont);
      upperLeftText.setTextOrigin(VPos.BASELINE);
      upperLeftText.setTextAlignment(TextAlignment.RIGHT);
      upperLeftText.setX(pane.getLayoutBounds().getMinX() + 0.0416666667 * height);
      upperLeftText.setY(
          pane.getLayoutBounds().getMinY()
              + upperLeftText.getLayoutBounds().getHeight()
              - 0.04 * height
              + 4);

      // Max measured value
      upperRightText.setFont(smallFont);
      upperRightText.setTextOrigin(VPos.BASELINE);
      upperRightText.setTextAlignment(TextAlignment.RIGHT);
      upperRightText.setY(
          pane.getLayoutBounds().getMinY()
              + upperRightText.getLayoutBounds().getHeight()
              - 0.04 * height
              + 4);

      // Former value
      lowerCenterText.setFont(smallFont);
      lowerCenterText.setTextOrigin(VPos.BASELINE);
      lowerCenterText.setTextAlignment(TextAlignment.CENTER);
      lowerCenterText.setX((width - lowerCenterText.getLayoutBounds().getWidth()) * 0.5);
      lowerCenterText.setY(pane.getLayoutBounds().getMinY() + height - 4 - 0.0416666667 * height);
    }
  }
コード例 #4
0
ファイル: LcdSkin.java プロジェクト: jforge/Medusa
  private void initGraphics() {
    mainInnerShadow0 = new InnerShadow();
    mainInnerShadow0.setOffsetX(0.0);
    mainInnerShadow0.setOffsetY(0.0);
    mainInnerShadow0.setRadius(0.0625 * PREFERRED_HEIGHT);
    mainInnerShadow0.setColor(Color.rgb(255, 255, 255, 0.5));
    mainInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX);

    mainInnerShadow1 = new InnerShadow();
    mainInnerShadow1.setOffsetX(0.0);
    mainInnerShadow1.setOffsetY(1.0);
    mainInnerShadow1.setRadius(0.04166667 * PREFERRED_HEIGHT);
    mainInnerShadow1.setColor(Color.rgb(0, 0, 0, 0.65));
    mainInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX);
    mainInnerShadow1.setInput(mainInnerShadow0);

    crystalClip = new Rectangle(0, 0, width, height);
    crystalClip.setArcWidth(5);
    crystalClip.setArcHeight(5);

    crystalImage =
        Helper.createNoiseImage(
            PREFERRED_WIDTH, PREFERRED_HEIGHT, DARK_NOISE_COLOR, BRIGHT_NOISE_COLOR, 8);
    crystalOverlay = new ImageView(crystalImage);
    crystalOverlay.setClip(crystalClip);
    boolean crystalEnabled = getSkinnable().isLcdCrystalEnabled();
    crystalOverlay.setManaged(crystalEnabled);
    crystalOverlay.setVisible(crystalEnabled);

    threshold = new Path();
    threshold.setManaged(getSkinnable().isThresholdVisible());
    threshold.setVisible(getSkinnable().isThresholdVisible());
    threshold.setStroke(null);

    backgroundText =
        new Text(String.format(Locale.US, valueFormatString, getSkinnable().getCurrentValue()));
    backgroundText.setFill(getSkinnable().getLcdDesign().lcdBackgroundColor);
    backgroundText.setOpacity(
        (LcdFont.LCD == getSkinnable().getLcdFont()
                || LcdFont.ELEKTRA == getSkinnable().getLcdFont())
            ? 1
            : 0);

    valueText =
        new Text(String.format(Locale.US, valueFormatString, getSkinnable().getCurrentValue()));
    valueText.setFill(getSkinnable().getLcdDesign().lcdForegroundColor);

    unitText = new Text(getSkinnable().getUnit());
    unitText.setFill(getSkinnable().getLcdDesign().lcdForegroundColor);
    unitText.setManaged(!getSkinnable().getUnit().isEmpty());
    unitText.setVisible(!getSkinnable().getUnit().isEmpty());

    title = new Text(getSkinnable().getTitle());
    title.setFill(getSkinnable().getLcdDesign().lcdForegroundColor);
    title.setManaged(!getSkinnable().getTitle().isEmpty());
    title.setVisible(!getSkinnable().getTitle().isEmpty());

    lowerRightText = new Text(getSkinnable().getSubTitle());
    lowerRightText.setFill(getSkinnable().getLcdDesign().lcdForegroundColor);
    lowerRightText.setManaged(!getSkinnable().getSubTitle().isEmpty());
    lowerRightText.setVisible(!getSkinnable().getSubTitle().isEmpty());

    upperLeftText =
        new Text(String.format(Locale.US, otherFormatString, getSkinnable().getMinMeasuredValue()));
    upperLeftText.setFill(getSkinnable().getLcdDesign().lcdForegroundColor);
    upperLeftText.setManaged(getSkinnable().isMinMeasuredValueVisible());
    upperLeftText.setVisible(getSkinnable().isMinMeasuredValueVisible());

    upperRightText =
        new Text(String.format(Locale.US, otherFormatString, getSkinnable().getMaxMeasuredValue()));
    upperRightText.setFill(getSkinnable().getLcdDesign().lcdForegroundColor);
    upperRightText.setManaged(getSkinnable().isMaxMeasuredValueVisible());
    upperRightText.setVisible(getSkinnable().isMaxMeasuredValueVisible());

    lowerCenterText =
        new Text(String.format(Locale.US, otherFormatString, getSkinnable().getOldValue()));
    lowerCenterText.setFill(getSkinnable().getLcdDesign().lcdForegroundColor);
    lowerCenterText.setManaged(getSkinnable().isOldValueVisible());
    lowerCenterText.setVisible(getSkinnable().isOldValueVisible());

    shadowGroup = new Group();
    shadowGroup.setEffect(getSkinnable().isShadowsEnabled() ? FOREGROUND_SHADOW : null);
    shadowGroup
        .getChildren()
        .setAll(
            threshold,
            valueText,
            unitText,
            title,
            lowerRightText,
            upperLeftText,
            upperRightText,
            lowerCenterText);

    pane = new Pane(crystalOverlay, backgroundText, shadowGroup);
    pane.setEffect(getSkinnable().isShadowsEnabled() ? mainInnerShadow1 : null);
    getChildren().setAll(pane);
  }
コード例 #5
0
 static {
   shadowGreen.setBlurType(BlurType.ONE_PASS_BOX);
   shadowRed.setBlurType(BlurType.ONE_PASS_BOX);
 }
コード例 #6
0
ファイル: LinearSkin.java プロジェクト: jforge/Medusa
  private void resize() {
    width =
        getSkinnable().getWidth()
            - getSkinnable().getInsets().getLeft()
            - getSkinnable().getInsets().getRight();
    height =
        getSkinnable().getHeight()
            - getSkinnable().getInsets().getTop()
            - getSkinnable().getInsets().getBottom();

    if (width > 0 && height > 0) {
      orientation = getSkinnable().getOrientation();

      double currentValue = getSkinnable().getCurrentValue();
      Color tickMarkColor = getSkinnable().getTickMarkColor();
      Color barBorderColor =
          Color.color(
              tickMarkColor.getRed(), tickMarkColor.getGreen(), tickMarkColor.getBlue(), 0.5);
      boolean isFlatLed = LedType.FLAT == getSkinnable().getLedType();

      if (Orientation.VERTICAL == orientation) {
        width = height / aspectRatio;
        size = width < height ? width : height;
        stepSize = Math.abs((0.66793 * height) / getSkinnable().getRange());

        pane.setMaxSize(width, height);
        pane.relocate(
            (getSkinnable().getWidth() - width) * 0.5, (getSkinnable().getHeight() - height) * 0.5);

        barBackground.setWidth(0.14286 * width);
        barBackground.setHeight(0.67143 * height);
        barBackground.relocate(
            (width - barBackground.getWidth()) * 0.5, (height - barBackground.getHeight()) * 0.5);
        barBackground.setStroke(null);
        barBackground.setFill(
            new LinearGradient(
                0,
                barBackground.getLayoutBounds().getMinY(),
                0,
                barBackground.getLayoutBounds().getMaxY(),
                false,
                CycleMethod.NO_CYCLE,
                new Stop(0.0, Color.rgb(255, 255, 255, 0.05)),
                new Stop(0.5, Color.rgb(255, 255, 255, 0.15)),
                new Stop(1.0, Color.rgb(255, 255, 255, 0.05))));

        minValuePosition = barBackground.getLayoutY() + barBackground.getLayoutBounds().getHeight();
        maxValuePosition = barBackground.getLayoutY();
        zeroPosition = minValuePosition + getSkinnable().getMinValue() * stepSize;
        zeroPosition = zeroPosition > minValuePosition ? minValuePosition : zeroPosition;

        barBorder1.setStartX(barBackground.getLayoutX() - 1);
        barBorder1.setStartY(maxValuePosition);
        barBorder1.setEndX(barBackground.getLayoutX() - 1);
        barBorder1.setEndY(minValuePosition);
        barBorder2.setStartX(
            barBackground.getLayoutX() + barBackground.getLayoutBounds().getWidth() + 1);
        barBorder2.setStartY(maxValuePosition);
        barBorder2.setEndX(
            barBackground.getLayoutX() + barBackground.getLayoutBounds().getWidth() + 1);
        barBorder2.setEndY(minValuePosition);

        barBorder1.setStroke(barBorderColor);
        barBorder2.setStroke(barBorderColor);

        bar.setWidth(0.14286 * width);
        bar.setTranslateX((width - bar.getWidth()) * 0.5);
        bar.setTranslateY(getSkinnable().isStartFromZero() ? zeroPosition : minValuePosition);

        barHighlight.setWidth(bar.getWidth());
        barHighlight.setTranslateX(bar.getTranslateX());
        barHighlight.setTranslateY(bar.getTranslateY());

        setBar(currentValue);

        ticksAndSectionsCanvas.setCache(false);
        ticksAndSectionsCanvas.setWidth(height / aspectRatio);
        ticksAndSectionsCanvas.setHeight(height);
        ticksAndSections.clearRect(
            0, 0, ticksAndSectionsCanvas.getWidth(), ticksAndSectionsCanvas.getHeight());
        drawTickMarks(ticksAndSections);
        ticksAndSectionsCanvas.setCache(true);
        ticksAndSectionsCanvas.setCacheHint(CacheHint.QUALITY);

        ledSize = isFlatLed ? 0.08 * width : 0.09 * width;
        ledCanvas.setWidth(ledSize);
        ledCanvas.setHeight(ledSize);
        ledCanvas.relocate((width - ledSize) * 0.5, 0.12 * height);
        ledOffShadow =
            isFlatLed
                ? null
                : new InnerShadow(
                    BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * ledSize, 0, 0, 0);
        ledOnShadow =
            isFlatLed
                ? null
                : new InnerShadow(
                    BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * ledSize, 0, 0, 0);
        if (!isFlatLed)
          ledOnShadow.setInput(
              new DropShadow(
                  BlurType.TWO_PASS_BOX, getSkinnable().getLedColor(), 0.36 * ledSize, 0, 0, 0));

        lcd.setWidth(0.8 * width);
        lcd.setHeight(0.22 * width);
        lcd.setArcWidth(0.0125 * size);
        lcd.setArcHeight(0.0125 * size);
        lcd.relocate((width - lcd.getWidth()) * 0.5, 0.87 * height);
      } else {
        height = width / aspectRatio;
        size = width < height ? width : height;
        stepSize = Math.abs(0.9 * width / getSkinnable().getRange());

        pane.setMaxSize(width, height);
        pane.relocate(
            (getSkinnable().getWidth() - width) * 0.5, (getSkinnable().getHeight() - height) * 0.5);

        barBackground.setWidth(0.9 * width);
        barBackground.setHeight(0.14286 * height);
        barBackground.relocate(
            (width - barBackground.getWidth()) * 0.5, (height - barBackground.getHeight()) * 0.5);
        barBackground.setStroke(null);
        barBackground.setFill(
            new LinearGradient(
                barBackground.getLayoutBounds().getMinX(),
                0,
                barBackground.getLayoutBounds().getMaxX(),
                0,
                false,
                CycleMethod.NO_CYCLE,
                new Stop(0.0, Color.rgb(255, 255, 255, 0.05)),
                new Stop(0.5, Color.rgb(255, 255, 255, 0.15)),
                new Stop(1.0, Color.rgb(255, 255, 255, 0.05))));

        minValuePosition = barBackground.getLayoutX();
        maxValuePosition = barBackground.getLayoutX() + barBackground.getLayoutBounds().getWidth();
        zeroPosition = minValuePosition - getSkinnable().getMinValue() * stepSize;
        zeroPosition = zeroPosition < minValuePosition ? minValuePosition : zeroPosition;

        barBorder1.setStartX(minValuePosition);
        barBorder1.setStartY(barBackground.getLayoutY() - 1);
        barBorder1.setEndX(maxValuePosition);
        barBorder1.setEndY(barBackground.getLayoutY() - 1);
        barBorder2.setStartX(minValuePosition);
        barBorder2.setStartY(
            barBackground.getLayoutY() + barBackground.getLayoutBounds().getHeight() + 1);
        barBorder2.setEndX(maxValuePosition);
        barBorder2.setEndY(
            barBackground.getLayoutY() + barBackground.getLayoutBounds().getHeight() + 1);

        barBorder1.setStroke(barBorderColor);
        barBorder2.setStroke(barBorderColor);

        bar.setHeight(0.14286 * height);
        bar.setTranslateX(getSkinnable().isStartFromZero() ? zeroPosition : minValuePosition);
        bar.setTranslateY((height - bar.getHeight()) * 0.5);

        barHighlight.setHeight(bar.getHeight());
        barHighlight.setTranslateX(bar.getTranslateX());
        barHighlight.setTranslateY(bar.getTranslateY());

        setBar(currentValue);

        ticksAndSectionsCanvas.setCache(false);
        ticksAndSectionsCanvas.setWidth(width);
        ticksAndSectionsCanvas.setHeight(height);
        ticksAndSections.clearRect(
            0, 0, ticksAndSectionsCanvas.getWidth(), ticksAndSectionsCanvas.getHeight());
        drawTickMarks(ticksAndSections);
        ticksAndSectionsCanvas.setCache(true);
        ticksAndSectionsCanvas.setCacheHint(CacheHint.QUALITY);

        ledSize = isFlatLed ? 0.08 * height : 0.09 * height;
        ledCanvas.setWidth(ledSize);
        ledCanvas.setHeight(ledSize);
        ledCanvas.relocate(0.955 * width, (height - ledSize) * 0.5);
        ledOffShadow =
            isFlatLed
                ? null
                : new InnerShadow(
                    BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * ledSize, 0, 0, 0);
        ledOnShadow =
            isFlatLed
                ? null
                : new InnerShadow(
                    BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * ledSize, 0, 0, 0);
        if (!isFlatLed)
          ledOnShadow.setInput(
              new DropShadow(
                  BlurType.TWO_PASS_BOX, getSkinnable().getLedColor(), 0.36 * ledSize, 0, 0, 0));

        lcd.setWidth(0.3 * width);
        lcd.setHeight(0.22 * height);
        lcd.setArcWidth(0.0125 * size);
        lcd.setArcHeight(0.0125 * size);
        lcd.relocate((width - lcd.getWidth()) - 0.03571429 * height, 0.03571429 * height);
      }

      resizeText();
    }
  }
コード例 #7
0
ファイル: LedSkin.java プロジェクト: uphy/jfxtras-labs
  // ******************** Drawing related ***********************************
  public final void drawLed() {
    final double SIZE =
        control.getPrefWidth() < control.getPrefHeight()
            ? control.getPrefWidth()
            : control.getPrefHeight();
    final double WIDTH = SIZE;
    final double HEIGHT = SIZE;

    led.setStyle("-fx-led: " + Util.colorToCssColor(control.getColor()));

    final Shape IBOUNDS = new Rectangle(0, 0, WIDTH, HEIGHT);
    IBOUNDS.setOpacity(0.0);

    final Shape LED_FRAME;
    final Shape LED_OFF;
    final Shape HIGHLIGHT;

    switch (control.getType()) {
      case SQUARE:
        LED_FRAME = new Rectangle(0.0625 * WIDTH, 0.0625 * HEIGHT, 0.875 * WIDTH, 0.875 * HEIGHT);
        LED_OFF = new Rectangle(0.1875 * WIDTH, 0.1875 * HEIGHT, 0.625 * WIDTH, 0.625 * HEIGHT);
        ledOn = new Rectangle(0.1875 * WIDTH, 0.1875 * HEIGHT, 0.625 * WIDTH, 0.625 * HEIGHT);
        HIGHLIGHT = new Rectangle(0.25 * WIDTH, 0.25 * HEIGHT, 0.5 * WIDTH, 0.1875 * HEIGHT);
        break;
      case VERTICAL:
        LED_FRAME = new Rectangle(0.25 * WIDTH, 0.0625 * HEIGHT, 0.5 * WIDTH, 0.875 * HEIGHT);
        LED_OFF = new Rectangle(0.3125 * WIDTH, 0.125 * HEIGHT, 0.375 * WIDTH, 0.75 * HEIGHT);
        ledOn = new Rectangle(0.3125 * WIDTH, 0.125 * HEIGHT, 0.375 * WIDTH, 0.75 * HEIGHT);
        HIGHLIGHT = new Rectangle(0.3125 * WIDTH, 0.125 * HEIGHT, 0.375 * WIDTH, 0.375 * HEIGHT);
        break;
      case HORIZONTAL:
        LED_FRAME = new Rectangle(0.0625 * WIDTH, 0.25 * HEIGHT, 0.875 * WIDTH, 0.5 * HEIGHT);
        LED_OFF = new Rectangle(0.125 * WIDTH, 0.3125 * HEIGHT, 0.75 * WIDTH, 0.375 * HEIGHT);
        ledOn = new Rectangle(0.125 * WIDTH, 0.3125 * HEIGHT, 0.75 * WIDTH, 0.375 * HEIGHT);
        HIGHLIGHT = new Rectangle(0.125 * WIDTH, 0.3125 * HEIGHT, 0.75 * WIDTH, 0.1875 * HEIGHT);
        break;
      case ROUND:
      default:
        LED_FRAME = new Circle(0.5 * WIDTH, 0.5 * HEIGHT, 0.4375 * WIDTH);
        LED_OFF = new Circle(0.5 * WIDTH, 0.5 * HEIGHT, 0.3125 * WIDTH);
        ledOn = new Circle(0.5 * WIDTH, 0.5 * HEIGHT, 0.3125 * WIDTH);
        HIGHLIGHT = new Circle(0.5 * WIDTH, 0.5 * HEIGHT, 0.2 * WIDTH);
        break;
    }

    LED_FRAME.getStyleClass().add("frame");

    LED_OFF.getStyleClass().clear();
    LED_OFF.getStyleClass().add("off");
    LED_OFF.setStyle("-fx-led: " + Util.colorToCssColor(control.getColor()));

    ledOn.getStyleClass().clear();
    ledOn.getStyleClass().add("on");
    ledOn.setStyle("-fx-led: " + Util.colorToCssColor(control.getColor()));
    ledOn.setVisible(control.isOn());

    HIGHLIGHT.getStyleClass().add("highlight");

    if (LED_FRAME.visibleProperty().isBound()) {
      LED_FRAME.visibleProperty().unbind();
    }
    LED_FRAME.visibleProperty().bind(control.frameVisibleProperty());

    final InnerShadow INNER_SHADOW = new InnerShadow();
    INNER_SHADOW.setWidth(0.180 * SIZE);
    INNER_SHADOW.setHeight(0.180 * SIZE);
    INNER_SHADOW.setRadius(0.15 * SIZE);
    INNER_SHADOW.setColor(Color.BLACK);
    INNER_SHADOW.setBlurType(BlurType.GAUSSIAN);
    LED_OFF.setEffect(INNER_SHADOW);

    final DropShadow GLOW = new DropShadow();
    GLOW.setSpread(0.35);
    GLOW.setRadius(0.16 * ledOn.getLayoutBounds().getWidth());
    GLOW.setColor(control.getColor());
    GLOW.setBlurType(BlurType.GAUSSIAN);
    GLOW.setInput(INNER_SHADOW);
    ledOn.setEffect(GLOW);

    led.getChildren().setAll(IBOUNDS, LED_FRAME, LED_OFF, ledOn, HIGHLIGHT);

    led.setCache(true);
  }