Java Code Examples for javafx.scene.effect.DropShadow#setInput()
The following examples show how to use
javafx.scene.effect.DropShadow#setInput() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LedSkin.java From Enzo with Apache License 2.0 | 6 votes |
private void initGraphics() { frame = new Region(); frame.setOpacity(getSkinnable().isFrameVisible() ? 1 : 0); led = new Region(); led.setStyle("-led-color: " + Util.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(); // Add all nodes getChildren().setAll(frame, led, highlight); }
Example 2
Source File: LedSkin.java From JFX8CustomControls with Apache License 2.0 | 6 votes |
private void initGraphics() { frame = new Region(); frame.getStyleClass().setAll("frame"); frame.setOpacity(getSkinnable().isFrameVisible() ? 1 : 0); led = new Region(); led.getStyleClass().setAll("main"); led.setStyle("-led-color: " + (getSkinnable().getLedColor()).toString().replace("0x", "#") + ";"); 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(); highlight.getStyleClass().setAll("highlight"); getChildren().addAll(frame, led, highlight); }
Example 3
Source File: Led.java From JFX8CustomControls with Apache License 2.0 | 6 votes |
private void initGraphics() { frame = new Region(); frame.getStyleClass().setAll("frame"); frame.setOpacity(isFrameVisible() ? 1 : 0); led = new Region(); led.getStyleClass().setAll("main"); led.setStyle("-led-color: " + (getLedColor()).toString().replace("0x", "#") + ";"); 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, getLedColor(), 20, 0d, 0d, 0d); glow.setInput(innerShadow); highlight = new Region(); highlight.getStyleClass().setAll("highlight"); // Add all nodes getChildren().addAll(frame, led, highlight); }
Example 4
Source File: GameMenuDemo.java From FXTutorials with MIT License | 5 votes |
public MenuButton(String name) { text = new Text(name); text.setFont(text.getFont().font(20)); text.setFill(Color.WHITE); Rectangle bg = new Rectangle(250, 30); bg.setOpacity(0.6); bg.setFill(Color.BLACK); bg.setEffect(new GaussianBlur(3.5)); setAlignment(Pos.CENTER_LEFT); setRotate(-0.5); getChildren().addAll(bg, text); setOnMouseEntered(event -> { bg.setTranslateX(10); text.setTranslateX(10); bg.setFill(Color.WHITE); text.setFill(Color.BLACK); }); setOnMouseExited(event -> { bg.setTranslateX(0); text.setTranslateX(0); bg.setFill(Color.BLACK); text.setFill(Color.WHITE); }); DropShadow drop = new DropShadow(50, Color.WHITE); drop.setInput(new Glow()); setOnMousePressed(event -> setEffect(drop)); setOnMouseReleased(event -> setEffect(null)); }
Example 5
Source File: LedSkin.java From JFX8CustomControls with Apache License 2.0 | 5 votes |
private void initGraphics() { size = getSkinnable().getPrefWidth() < getSkinnable().getPrefHeight() ? getSkinnable().getPrefWidth() : getSkinnable().getPrefHeight(); frame = new Circle(0.5 * size, 0.5 * size, 0.5 * size); frame.setStroke(null); frame.setVisible(getSkinnable().isFrameVisible()); main = new Circle(0.5 * size, 0.5 * size, 0.36 * size); main.setStroke(null); innerShadow = new InnerShadow(); innerShadow.setRadius(0.090 * main.getLayoutBounds().getWidth()); innerShadow.setColor(Color.BLACK); innerShadow.setBlurType(BlurType.GAUSSIAN); innerShadow.setInput(null); glow = new DropShadow(); glow.setRadius(0.45 * main.getLayoutBounds().getWidth()); glow.setColor((Color) getSkinnable().getLedColor()); glow.setBlurType(BlurType.GAUSSIAN); glow.setInput(innerShadow); highlight = new Circle(0.5 * size, 0.5 * size, 0.29 * size); highlight.setStroke(null); getChildren().setAll(frame, main, highlight); }
Example 6
Source File: Regulator.java From regulators with Apache License 2.0 | 4 votes |
private void initGraphics() { dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_WIDTH * 0.016, 0.0, 0, PREFERRED_WIDTH * 0.028); highlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008); innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008); highlight.setInput(innerShadow); dropShadow.setInput(highlight); barArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0); barArc.setType(ArcType.OPEN); barArc.setStrokeLineCap(StrokeLineCap.ROUND); barArc.setFill(null); barArc.setStroke(barColor.get()); double center = PREFERRED_WIDTH * 0.5; ring = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.42), new Circle(center, center, PREFERRED_WIDTH * 0.3)); ring.setFill(color.get()); ring.setEffect(dropShadow); mainCircle = new Circle(); mainCircle.setFill(color.get().darker().darker()); text = new Text(String.format(Locale.US, formatString, getTargetValue())); text.setFill(Color.WHITE); text.setTextOrigin(VPos.CENTER); indicatorRotate = new Rotate(-ANGLE_RANGE * 0.5, center, center); indicatorGlow = new DropShadow(BlurType.TWO_PASS_BOX, getIndicatorColor(), PREFERRED_WIDTH * 0.02, 0.0, 0, 0); indicatorInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.5), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008); indicatorHighlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008); indicatorHighlight.setInput(indicatorInnerShadow); indicator = new Circle(); indicator.setFill(color.get().darker()); indicator.setStroke(color.get().darker().darker()); indicator.setMouseTransparent(true); indicator.getTransforms().add(indicatorRotate); Group indicatorGroup = new Group(indicator); indicatorGroup.setEffect(indicatorHighlight); symbol = new Region(); symbol.getStyleClass().setAll("symbol"); symbol.setCacheHint(CacheHint.SPEED); icon = new FontIcon(); icon.setTextOrigin(VPos.CENTER); iconPane = new StackPane(symbol, icon); pane = new Pane(barArc, ring, mainCircle, text, indicatorGroup, iconPane); pane.setPrefSize(PREFERRED_HEIGHT, PREFERRED_HEIGHT); pane.setBackground(new Background(new BackgroundFill(color.get().darker(), new CornerRadii(1024), Insets.EMPTY))); pane.setEffect(highlight); getChildren().setAll(pane); }
Example 7
Source File: ColorRegulator.java From regulators with Apache License 2.0 | 4 votes |
private void initGraphics() { dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_WIDTH * 0.016, 0.0, 0, PREFERRED_WIDTH * 0.028); highlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008); innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008); highlight.setInput(innerShadow); dropShadow.setInput(highlight); Stop[] stops = { new Stop(0.0, Color.rgb(255,255,0)), new Stop(0.125, Color.rgb(255,0,0)), new Stop(0.375, Color.rgb(255,0,255)), new Stop(0.5, Color.rgb(0,0,255)), new Stop(0.625, Color.rgb(0,255,255)), new Stop(0.875, Color.rgb(0,255,0)), new Stop(1.0, Color.rgb(255,255,0)) }; List<Stop> reorderedStops = reorderStops(stops); gradientLookup = new GradientLookup(stops); barGradient = new ConicalGradient(reorderedStops); barArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0); barArc.setType(ArcType.OPEN); barArc.setStrokeLineCap(StrokeLineCap.ROUND); barArc.setFill(null); barArc.setStroke(barGradient.getImagePattern(new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT))); buttonOn = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, -125, 34.75); buttonOn.setFill(null); buttonOn.setStroke(color.get()); buttonOn.setStrokeLineCap(StrokeLineCap.BUTT); buttonOn.setStrokeWidth(PREFERRED_WIDTH * 0.072); buttonOn.setEffect(dropShadow); buttonOff = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, -89.75, 34.75); buttonOff.setFill(null); buttonOff.setStroke(color.get()); buttonOff.setStrokeLineCap(StrokeLineCap.BUTT); buttonOff.setStrokeWidth(PREFERRED_WIDTH * 0.072); buttonOff.setEffect(dropShadow); double center = PREFERRED_WIDTH * 0.5; ring = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.42), new Circle(center, center, PREFERRED_WIDTH * 0.3)); ring.setFill(color.get()); ring.setEffect(highlight); mainCircle = new Circle(); mainCircle.setFill(color.get().darker().darker()); textOn = new Text("ON"); textOn.setFill(textColor.get()); textOn.setTextOrigin(VPos.CENTER); textOn.setMouseTransparent(true); textOn.setRotate(17); textOff = new Text("OFF"); textOff.setFill(textColor.get()); textOff.setTextOrigin(VPos.CENTER); textOff.setMouseTransparent(true); textOff.setRotate(-17); indicatorRotate = new Rotate(-ANGLE_RANGE * 0.5, center, center); indicatorGlow = new DropShadow(BlurType.TWO_PASS_BOX, getIndicatorColor(), PREFERRED_WIDTH * 0.02, 0.0, 0, 0); indicatorInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.5), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008); indicatorHighlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008); indicatorHighlight.setInput(indicatorInnerShadow); indicator = new Circle(); indicator.setFill(color.get().darker()); indicator.setStroke(color.get().darker().darker()); indicator.setMouseTransparent(true); indicator.getTransforms().add(indicatorRotate); Group indicatorGroup = new Group(indicator); indicatorGroup.setEffect(indicatorHighlight); innerRing = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.24), new Circle(center, center, PREFERRED_WIDTH * 0.2)); innerRing.setFill(color.get()); currentColorCircle = new Circle(); currentColorCircle.setFill(targetColor.get()); currentColorCircle.setVisible(isOn()); pane = new Pane(barArc, ring, mainCircle, currentColorCircle, innerRing, indicatorGroup, buttonOn, textOn, buttonOff, textOff); pane.setPrefSize(PREFERRED_HEIGHT, PREFERRED_HEIGHT); pane.setBackground(new Background(new BackgroundFill(color.get().darker(), new CornerRadii(1024), Insets.EMPTY))); pane.setEffect(highlight); getChildren().setAll(pane); }
Example 8
Source File: FeedbackRegulator.java From regulators with Apache License 2.0 | 4 votes |
private void initGraphics() { dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_WIDTH * 0.016, 0.0, 0, PREFERRED_WIDTH * 0.028); highlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008); innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008); highlight.setInput(innerShadow); dropShadow.setInput(highlight); Stop[] stops = { new Stop(0.0, Color.rgb(135, 255, 190)), new Stop(0.125, Color.rgb(254, 190, 106)), new Stop(0.389, Color.rgb(252, 84, 68)), new Stop(0.611, Color.rgb(99, 195, 255)), new Stop(1.0, Color.rgb(125, 255, 190)) }; barGradient = new ConicalGradient(stops); barArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0); barArc.setType(ArcType.OPEN); barArc.setStrokeLineCap(StrokeLineCap.ROUND); barArc.setFill(null); barArc.setStroke(barGradient.getImagePattern(new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT))); overlayBarArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0); overlayBarArc.setType(ArcType.OPEN); overlayBarArc.setStrokeLineCap(StrokeLineCap.ROUND); overlayBarArc.setFill(null); overlayBarArc.setStroke(Color.rgb(0, 0, 0, 0.3)); overlayBarArc.setVisible((int) targetValue.get() != (int) currentValue.get()); double center = PREFERRED_WIDTH * 0.5; ring = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.42), new Circle(center, center, PREFERRED_WIDTH * 0.3)); ring.setFill(color.get()); ring.setEffect(dropShadow); mainCircle = new Circle(); mainCircle.setFill(color.get().darker().darker()); text = new Text(String.format(Locale.US, formatString, currentValue.get())); text.setFill(textColor.get()); text.setTextOrigin(VPos.CENTER); targetText = new Text(String.format(Locale.US, formatString, targetValue.get())); targetText.setFill(textColor.get().darker()); targetText.setTextOrigin(VPos.CENTER); targetText.setVisible((int) targetValue.get() != (int) currentValue.get()); indicatorRotate = new Rotate(-ANGLE_RANGE * 0.5, center, center); indicatorGlow = new DropShadow(BlurType.TWO_PASS_BOX, getIndicatorColor(), PREFERRED_WIDTH * 0.02, 0.0, 0, 0); indicatorInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.5), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008); indicatorHighlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008); indicatorHighlight.setInput(indicatorInnerShadow); indicator = new Circle(); indicator.setFill(color.get().darker()); indicator.setStroke(color.get().darker().darker()); indicator.setMouseTransparent(true); indicator.getTransforms().add(indicatorRotate); Group indicatorGroup = new Group(indicator); indicatorGroup.setEffect(indicatorHighlight); symbol = new Region(); symbol.getStyleClass().setAll("symbol"); symbol.setCacheHint(CacheHint.SPEED); icon = new FontIcon(); icon.setTextOrigin(VPos.CENTER); iconPane = new StackPane(symbol, icon); pane = new Pane(barArc, overlayBarArc, ring, mainCircle, text, targetText, indicatorGroup, iconPane); pane.setPrefSize(PREFERRED_HEIGHT, PREFERRED_HEIGHT); pane.setBackground(new Background(new BackgroundFill(color.get().darker(), new CornerRadii(1024), Insets.EMPTY))); pane.setEffect(highlight); getChildren().setAll(pane); }
Example 9
Source File: PushButtonSkin.java From Enzo with Apache License 2.0 | 4 votes |
private void initGraphics() { frame = new Region(); frame.getStyleClass().setAll("frame"); frameInnerShadow0 = new InnerShadow(); frameInnerShadow0.setOffsetX(0); frameInnerShadow0.setOffsetY(1); frameInnerShadow0.setRadius(0); frameInnerShadow0.setColor(Color.web("0x333333a6")); frameInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX); frameInnerShadow1 = new InnerShadow(); frameInnerShadow1.setOffsetX(0); frameInnerShadow1.setOffsetY(-1); frameInnerShadow1.setRadius(0); frameInnerShadow1.setColor(Color.web("0xeeeeeea6")); frameInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX); frameInnerShadow1.setInput(frameInnerShadow0); frame.setEffect(frameInnerShadow1); deselected = new Region(); deselected.getStyleClass().setAll("deselected"); deselectedInnerShadow0 = new InnerShadow(); deselectedInnerShadow0.setOffsetX(0); deselectedInnerShadow0.setOffsetY(-1); deselectedInnerShadow0.setRadius(0); deselectedInnerShadow0.setColor(Color.web("0x4b4e52a6")); deselectedInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX); deselectedInnerShadow1 = new InnerShadow(); deselectedInnerShadow1.setOffsetX(0); deselectedInnerShadow1.setOffsetY(1); deselectedInnerShadow1.setRadius(0); deselectedInnerShadow1.setColor(Color.web("0xeeeeeea6")); deselectedInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX); deselectedInnerShadow1.setInput(deselectedInnerShadow0); deselectedDropShadow = new DropShadow(); deselectedDropShadow.setOffsetX(0); deselectedDropShadow.setOffsetY(3); deselectedDropShadow.setRadius(3.0 / 128.0 * PREFERRED_WIDTH); deselectedDropShadow.setColor(Color.web("0x000000a6")); deselectedDropShadow.setBlurType(BlurType.TWO_PASS_BOX); deselectedDropShadow.setInput(deselectedInnerShadow1); deselected.setEffect(deselectedDropShadow); selected = new Region(); selected.getStyleClass().setAll("selected"); selectedInnerShadow0 = new InnerShadow(); selectedInnerShadow0.setOffsetX(0); selectedInnerShadow0.setOffsetY(-1); selectedInnerShadow0.setRadius(0); selectedInnerShadow0.setColor(Color.web("0x4b4e52a6")); selectedInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX); selectedInnerShadow1 = new InnerShadow(); selectedInnerShadow1.setOffsetX(0); selectedInnerShadow1.setOffsetY(1); selectedInnerShadow1.setRadius(0); selectedInnerShadow1.setColor(Color.web("0xeeeeeea6")); selectedInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX); selectedInnerShadow1.setInput(selectedInnerShadow0); selectedDropShadow = new DropShadow(); selectedDropShadow.setOffsetX(0); selectedDropShadow.setOffsetY(0); selectedDropShadow.setRadius(2.0 / 128.0 * PREFERRED_WIDTH); selectedDropShadow.setColor(Color.web("0x000000a6")); selectedDropShadow.setBlurType(BlurType.TWO_PASS_BOX); selectedDropShadow.setInput(selectedInnerShadow1); selected.setEffect(selectedDropShadow); icon = new Region(); icon.getStyleClass().setAll("icon"); pane.getChildren().setAll(frame, deselected, selected, icon); // Adjust visibility dependent on settings updateStatus(); getChildren().setAll(pane); resize(); }