Search in sources :

Example 16 with DropShadow

use of javafx.scene.effect.DropShadow in project Board-Instrumentation-Framework by intel.

the class RectangularGaugeSkin method initGraphics.

private void initGraphics() {
    ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ticksAndSections = ticksAndSectionsCanvas.getGraphicsContext2D();
    innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 8, 0d, 0d, 0d);
    glow = new DropShadow(BlurType.TWO_PASS_BOX, getSkinnable().getLedColor(), 20, 0d, 0d, 0d);
    glow.setInput(innerShadow);
    ledFrame = new Region();
    ledFrame.getStyleClass().setAll("led-frame");
    ledMain = new Region();
    ledMain.getStyleClass().setAll("led-main");
    ledMain.setStyle("-led-color: " + (colorToCss(getSkinnable().getLedColor())) + ";");
    ledHl = new Region();
    ledHl.getStyleClass().setAll("led-hl");
    needle = new Region();
    needle.getStyleClass().setAll(RectangularGauge.STYLE_CLASS_NEEDLE_STANDARD);
    needleRotate = new Rotate(180 - getSkinnable().getStartAngle());
    needleRotate.setAngle(needleRotate.getAngle() + (getSkinnable().getValue() - oldValue - getSkinnable().getMinValue()) * angleStep);
    needle.getTransforms().setAll(needleRotate);
    needleHighlight = new Region();
    needleHighlight.setMouseTransparent(true);
    needleHighlight.getStyleClass().setAll("needle-highlight");
    needleHighlight.getTransforms().setAll(needleRotate);
    dropShadow = new DropShadow();
    dropShadow.setColor(Color.rgb(0, 0, 0, 0.25));
    dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
    dropShadow.setRadius(0.015 * PREFERRED_WIDTH);
    dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH);
    shadowGroup = new Group(needle, needleHighlight);
    shadowGroup.setEffect(getSkinnable().isDropShadowEnabled() ? dropShadow : null);
    titleText = new Text(getSkinnable().getTitle());
    titleText.setTextOrigin(VPos.CENTER);
    titleText.getStyleClass().setAll("title");
    unitText = new Text(getSkinnable().getUnit());
    unitText.setMouseTransparent(true);
    unitText.setTextOrigin(VPos.CENTER);
    unitText.getStyleClass().setAll("unit");
    lcdText = new Label(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getValue()));
    lcdText.getStyleClass().setAll("lcd-text");
    // Set initial value
    angleStep = getSkinnable().getAngleRange() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue());
    double targetAngle = 180 - getSkinnable().getStartAngle() + (getSkinnable().getValue() - getSkinnable().getMinValue()) * angleStep;
    targetAngle = clamp(180 - getSkinnable().getStartAngle(), 180 - getSkinnable().getStartAngle() + getSkinnable().getAngleRange(), targetAngle);
    needleRotate.setAngle(targetAngle);
    lightEffect = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.65), 2, 0d, 0d, 2d);
    foreground = new Region();
    foreground.getStyleClass().setAll("foreground");
    foreground.setEffect(lightEffect);
    // Add all nodes
    pane = new Pane();
    pane.getChildren().setAll(ticksAndSectionsCanvas, ledFrame, ledMain, ledHl, unitText, lcdText, shadowGroup, foreground, titleText);
    getChildren().setAll(pane);
}
Also used : Group(javafx.scene.Group) Rotate(javafx.scene.transform.Rotate) InnerShadow(javafx.scene.effect.InnerShadow) Canvas(javafx.scene.canvas.Canvas) Label(javafx.scene.control.Label) Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) Pane(javafx.scene.layout.Pane) DropShadow(javafx.scene.effect.DropShadow)

Example 17 with DropShadow

use of javafx.scene.effect.DropShadow in project Board-Instrumentation-Framework by intel.

the class LedSkin method initGraphics.

private void initGraphics() {
    frame = new Region();
    frame.setOpacity(getSkinnable().isFrameVisible() ? 1 : 0);
    led = new Region();
    led.setStyle("-led-color: " + colorToCss((Color) getSkinnable().getLedColor()) + ";");
    innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 8, 0d, 0d, 0d);
    glow = new DropShadow(BlurType.TWO_PASS_BOX, (Color) getSkinnable().getLedColor(), 20, 0d, 0d, 0d);
    glow.setInput(innerShadow);
    highlight = new Region();
    // Set the appropriate style classes
    changeStyle();
    getChildren().setAll(frame, led, highlight);
}
Also used : InnerShadow(javafx.scene.effect.InnerShadow) Color(javafx.scene.paint.Color) Region(javafx.scene.layout.Region) DropShadow(javafx.scene.effect.DropShadow)

Example 18 with DropShadow

use of javafx.scene.effect.DropShadow in project Board-Instrumentation-Framework by intel.

the class ValidationPane method initGraphics.

private void initGraphics() {
    setMouseTransparent(true);
    canvas = new Canvas(getPrefWidth(), getPrefHeight());
    ctx = canvas.getGraphicsContext2D();
    DropShadow shadow = new DropShadow();
    shadow.setRadius(3);
    shadow.setColor(Color.rgb(0, 0, 0, 0.3));
    shadow.setBlurType(BlurType.TWO_PASS_BOX);
    shadow.setOffsetY(1);
    canvas.setEffect(shadow);
    getChildren().setAll(canvas);
}
Also used : Canvas(javafx.scene.canvas.Canvas) DropShadow(javafx.scene.effect.DropShadow)

Example 19 with DropShadow

use of javafx.scene.effect.DropShadow in project Board-Instrumentation-Framework by intel.

the class MySplash method init.

public void init() {
    if (false == _Show) {
        return;
    }
    Image splashImg;
    splashImg = getAlternateSplashImage();
    if (null == splashImg) {
        URL resource = MySplash.class.getResource("Logo.png");
        splashImg = new Image(resource.toString());
    }
    ImageView splash = new ImageView(splashImg);
    SPLASH_WIDTH = (int) splashImg.getWidth();
    loadProgress = new ProgressBar();
    loadProgress.setPrefWidth(SPLASH_WIDTH);
    progressText = new Label(Version.getVersion());
    progressText.setAlignment(Pos.CENTER);
    progressText.setStyle("-fx-content-display:center");
    splashLayout = new VBox();
    ((VBox) (splashLayout)).setAlignment(Pos.CENTER);
    splashLayout.getChildren().addAll(splash, loadProgress, progressText);
    splashLayout.setStyle("-fx-padding: 5; -fx-background-color: darkgray; -fx-border-width:5; -fx-border-color: darkslategray;");
    splashLayout.setEffect(new DropShadow());
}
Also used : Label(javafx.scene.control.Label) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image) ProgressBar(javafx.scene.control.ProgressBar) VBox(javafx.scene.layout.VBox) URL(java.net.URL) DropShadow(javafx.scene.effect.DropShadow)

Example 20 with DropShadow

use of javafx.scene.effect.DropShadow in project FXGL by AlmasB.

the class ProgressBar method setFill.

public void setFill(Color color) {
    innerBar.setFill(color);
    DropShadow ds = new DropShadow(15, color);
    ds.setInput(new Glow(0.5));
    innerBar.setEffect(ds);
}
Also used : Glow(javafx.scene.effect.Glow) DropShadow(javafx.scene.effect.DropShadow)

Aggregations

DropShadow (javafx.scene.effect.DropShadow)40 Pane (javafx.scene.layout.Pane)18 InnerShadow (javafx.scene.effect.InnerShadow)17 Region (javafx.scene.layout.Region)13 Text (javafx.scene.text.Text)13 Canvas (javafx.scene.canvas.Canvas)9 Group (javafx.scene.Group)8 Label (javafx.scene.control.Label)8 ImageView (javafx.scene.image.ImageView)8 Rotate (javafx.scene.transform.Rotate)6 AnchorPane (javafx.scene.layout.AnchorPane)5 Color (javafx.scene.paint.Color)5 Stop (javafx.scene.paint.Stop)5 Image (javafx.scene.image.Image)4 RadialGradient (javafx.scene.paint.RadialGradient)4 FXML (javafx.fxml.FXML)3 ProgressBar (javafx.scene.control.ProgressBar)3 StackPane (javafx.scene.layout.StackPane)3 VBox (javafx.scene.layout.VBox)3 LinearGradient (javafx.scene.paint.LinearGradient)3