javafx.scene.effect.DropShadow Java Examples

The following examples show how to use javafx.scene.effect.DropShadow. 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: JaceUIController.java    From jace with GNU General Public License v2.0 8 votes vote down vote up
public void displayNotification(String message) {
    Label oldNotification = currentNotification;
    Label notification = new Label(message);
    currentNotification = notification;
    notification.setEffect(new DropShadow(2.0, Color.BLACK));
    notification.setTextFill(Color.WHITE);
    notification.setBackground(new Background(new BackgroundFill(Color.rgb(0, 0, 80, 0.7), new CornerRadii(5.0), new Insets(-5.0))));
    Application.invokeLater(() -> {
        stackPane.getChildren().remove(oldNotification);
        stackPane.getChildren().add(notification);
    });

    notificationExecutor.schedule(() -> {
        Application.invokeLater(() -> {
            stackPane.getChildren().remove(notification);
        });
    }, 4, TimeUnit.SECONDS);
}
 
Example #2
Source File: Undecorator.java    From DevToolBox with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Prepare Stage for dock feedback display
 */
void buildDockFeedbackStage() {
    dockFeedbackPopup = new Stage(StageStyle.TRANSPARENT);
    dockFeedback = new Rectangle(0, 0, 100, 100);
    dockFeedback.setArcHeight(10);
    dockFeedback.setArcWidth(10);
    dockFeedback.setFill(Color.TRANSPARENT);
    dockFeedback.setStroke(Color.BLACK);
    dockFeedback.setStrokeWidth(2);
    dockFeedback.setCache(true);
    dockFeedback.setCacheHint(CacheHint.SPEED);
    dockFeedback.setEffect(new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 10, 0.2, 3, 3));
    dockFeedback.setMouseTransparent(true);
    BorderPane borderpane = new BorderPane();
    borderpane.setStyle("-fx-background-color:transparent"); //J8
    borderpane.setCenter(dockFeedback);
    Scene scene = new Scene(borderpane);
    scene.setFill(Color.TRANSPARENT);
    dockFeedbackPopup.setScene(scene);
    dockFeedbackPopup.sizeToScene();
}
 
Example #3
Source File: LedSkin.java    From Enzo with Apache License 2.0 6 votes vote down vote up
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 #4
Source File: DropShadowSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public DropShadowSample() {
    Text sample = new Text(0,40,"DropShadow Effect");
    sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,36));
    final DropShadow dropShadow = new DropShadow();
    sample.setEffect(dropShadow);
    getChildren().add(sample);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Radius", dropShadow.radiusProperty(), 0d, 20d),
            new SimplePropertySheet.PropDesc("Offset X", dropShadow.offsetXProperty(), -10d, 10d),
            new SimplePropertySheet.PropDesc("Offset Y", dropShadow.offsetYProperty(), -10d, 10d),
            new SimplePropertySheet.PropDesc("Spread", dropShadow.spreadProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Color", dropShadow.colorProperty())
    );
    // END REMOVE ME
}
 
Example #5
Source File: ClickableBitcoinAddress.java    From green_android with GNU General Public License v3.0 6 votes vote down vote up
@FXML
protected void showQRCode(MouseEvent event) {
    // Serialize to PNG and back into an image. Pretty lame but it's the shortest code to write and I'm feeling
    // lazy tonight.
    final byte[] imageBytes = QRCode
            .from(uri())
            .withSize(320, 240)
            .to(ImageType.PNG)
            .stream()
            .toByteArray();
    Image qrImage = new Image(new ByteArrayInputStream(imageBytes));
    ImageView view = new ImageView(qrImage);
    view.setEffect(new DropShadow());
    // Embed the image in a pane to ensure the drop-shadow interacts with the fade nicely, otherwise it looks weird.
    // Then fix the width/height to stop it expanding to fill the parent, which would result in the image being
    // non-centered on the screen. Finally fade/blur it in.
    Pane pane = new Pane(view);
    pane.setMaxSize(qrImage.getWidth(), qrImage.getHeight());
    final Main.OverlayUI<ClickableBitcoinAddress> overlay = Main.instance.overlayUI(pane, this);
    view.setOnMouseClicked(event1 -> overlay.done());
}
 
Example #6
Source File: ClickableBitcoinAddress.java    From devcoretalk with GNU General Public License v2.0 6 votes vote down vote up
@FXML
protected void showQRCode(MouseEvent event) {
    // Serialize to PNG and back into an image. Pretty lame but it's the shortest code to write and I'm feeling
    // lazy tonight.
    final byte[] imageBytes = QRCode
            .from(uri())
            .withSize(320, 240)
            .to(ImageType.PNG)
            .stream()
            .toByteArray();
    Image qrImage = new Image(new ByteArrayInputStream(imageBytes));
    ImageView view = new ImageView(qrImage);
    view.setEffect(new DropShadow());
    // Embed the image in a pane to ensure the drop-shadow interacts with the fade nicely, otherwise it looks weird.
    // Then fix the width/height to stop it expanding to fill the parent, which would result in the image being
    // non-centered on the screen. Finally fade/blur it in.
    Pane pane = new Pane(view);
    pane.setMaxSize(qrImage.getWidth(), qrImage.getHeight());
    final Main.OverlayUI<ClickableBitcoinAddress> overlay = Main.instance.overlayUI(pane, this);
    view.setOnMouseClicked(event1 -> overlay.done());
}
 
Example #7
Source File: Toast.java    From ApkToolPlus with Apache License 2.0 6 votes vote down vote up
public Toast(final String msg) {
    label = new Label(msg);
    String style =  "-fx-background-color:black;" +
            "-fx-background-radius:10;" +
            "-fx-font: 16px \"Microsoft YaHei\";" +
            "-fx-text-fill:white;-fx-padding:10;";
    label.setStyle(style);
    DropShadow dropShadow = new DropShadow();
    dropShadow.setBlurType(BlurType.THREE_PASS_BOX);
    dropShadow.setWidth(40);
    dropShadow.setHeight(40);
    dropShadow.setRadius(19.5);
    dropShadow.setOffsetX(0);
    dropShadow.setOffsetY(00);
    dropShadow.setColor(Color.color(0, 0, 0));
    label.setEffect(dropShadow);
}
 
Example #8
Source File: CreationMenuOnClickHandler.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
private Node createArrow(final boolean left) {
	// shape
	final Polygon arrow = new Polygon();
	arrow.getPoints().addAll(left ? LEFT_ARROW_POINTS : RIGHT_ARROW_POINTS);
	// style
	arrow.setStrokeWidth(ARROW_STROKE_WIDTH);
	arrow.setStroke(ARROW_STROKE);
	arrow.setFill(ARROW_FILL);
	// effect
	effectOnHover(arrow, new DropShadow(DROP_SHADOW_RADIUS, getHighlightColor()));
	// action
	arrow.setOnMouseClicked(new EventHandler<MouseEvent>() {
		@Override
		public void handle(MouseEvent event) {
			traverse(left);
		}
	});
	return arrow;
}
 
Example #9
Source File: MvcLogoExample.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
private static Effect createShadowEffect() {
	DropShadow outerShadow = new DropShadow();
	outerShadow.setRadius(3);
	outerShadow.setSpread(0.2);
	outerShadow.setOffsetX(3);
	outerShadow.setOffsetY(3);
	outerShadow.setColor(new Color(0.3, 0.3, 0.3, 1));

	Distant light = new Distant();
	light.setAzimuth(-135.0f);

	Lighting l = new Lighting();
	l.setLight(light);
	l.setSurfaceScale(3.0f);

	Blend effects = new Blend(BlendMode.MULTIPLY);
	effects.setTopInput(l);
	effects.setBottomInput(outerShadow);

	return effects;
}
 
Example #10
Source File: GeometryNodeSnippet.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
protected static Effect createShadowEffect() {
	final DropShadow outerShadow = new DropShadow();
	outerShadow.setRadius(3);
	outerShadow.setSpread(0.2);
	outerShadow.setOffsetX(3);
	outerShadow.setOffsetY(3);
	outerShadow.setColor(new Color(0.3, 0.3, 0.3, 1));

	final Distant light = new Distant();
	light.setAzimuth(-135.0f);

	final Lighting l = new Lighting();
	l.setLight(light);
	l.setSurfaceScale(3.0f);

	final Blend effects = new Blend(BlendMode.MULTIPLY);
	effects.setTopInput(l);
	effects.setBottomInput(outerShadow);

	return effects;
}
 
Example #11
Source File: ClockOfClocks.java    From medusademo with Apache License 2.0 6 votes vote down vote up
private Clock createClock() {
    Clock clock = ClockBuilder.create()
                              .skinType(ClockSkinType.FAT)
                              .backgroundPaint(Color.WHITE)
                              .prefSize(100, 100)
                              .animationDuration(7500)
                              .animated(true)
                              .discreteMinutes(false)
                              .discreteHours(true)
                              .hourTickMarkColor(Color.rgb(200, 200, 200))
                              .minuteTickMarkColor(Color.rgb(200, 200, 200))
                              .tickLabelColor(Color.rgb(200, 200, 200))
                              .build();
    clock.setEffect(new DropShadow(5, 0, 5, Color.rgb(0, 0, 0, 0.65)));
    return clock;
}
 
Example #12
Source File: TileSkin.java    From OEE-Designer with MIT License 6 votes vote down vote up
protected void initGraphics() {
    // Set initial size
    if (Double.compare(tile.getPrefWidth(), 0.0) <= 0 || Double.compare(tile.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(tile.getWidth(), 0.0) <= 0 || Double.compare(tile.getHeight(), 0.0) <= 0) {
        if (tile.getPrefWidth() > 0 && tile.getPrefHeight() > 0) {
            tile.setPrefSize(tile.getPrefWidth(), tile.getPrefHeight());
        } else {
            tile.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    shadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 3, 0, 0, 0);

    notifyRegion = new NotifyRegion();
    enableNode(notifyRegion, false);

    pane = new Pane(notifyRegion);
    pane.setBorder(new Border(new BorderStroke(tile.getBorderColor(), BorderStrokeStyle.SOLID, new CornerRadii(PREFERRED_WIDTH * 0.025), new BorderWidths(tile.getBorderWidth()))));
    pane.setBackground(new Background(new BackgroundFill(tile.getBackgroundColor(), new CornerRadii(PREFERRED_WIDTH * 0.025), Insets.EMPTY)));

    getChildren().setAll(pane);
}
 
Example #13
Source File: CustomGaugeSkin.java    From medusademo with Apache License 2.0 6 votes vote down vote up
private void initGraphics() {
    backgroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    backgroundCtx    = backgroundCanvas.getGraphicsContext2D();

    foregroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    foregroundCtx    = foregroundCanvas.getGraphicsContext2D();

    ledInnerShadow   = new InnerShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 0.2 * PREFERRED_WIDTH, 0, 0, 0);
    ledDropShadow    = new DropShadow(BlurType.TWO_PASS_BOX, getSkinnable().getBarColor(), 0.3 * PREFERRED_WIDTH, 0, 0, 0);

    pane = new Pane(backgroundCanvas, foregroundCanvas);
    pane.setBorder(new Border(new BorderStroke(getSkinnable().getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1))));
    pane.setBackground(new Background(new BackgroundFill(getSkinnable().getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

    getChildren().setAll(pane);
}
 
Example #14
Source File: IconText.java    From helloiot with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Node buildIcon(StringFormat format, byte[] value) {
    Text t = new Text(format.format(format.value(value)));
    t.setFont(Font.font(ExternalFonts.SOURCESANSPRO_BLACK, FontWeight.BOLD, 32.0));
    t.setFill(Color.WHITE);
    
    DropShadow dropShadow = new DropShadow();
    dropShadow.setRadius(4.0);
    dropShadow.setColor(Color.BLACK /* valueOf("#4b5157")*/);
    dropShadow.setBlurType(BlurType.ONE_PASS_BOX);
    t.setEffect(dropShadow);
   
    return t;
}
 
Example #15
Source File: LedSkin.java    From JFX8CustomControls with Apache License 2.0 6 votes vote down vote up
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 #16
Source File: IOSApp.java    From FXTutorials with MIT License 5 votes vote down vote up
public ToggleSwitch() {
    Rectangle background = new Rectangle(100, 50);
    background.setArcWidth(50);
    background.setArcHeight(50);
    background.setFill(Color.WHITE);
    background.setStroke(Color.LIGHTGRAY);

    Circle trigger = new Circle(25);
    trigger.setCenterX(25);
    trigger.setCenterY(25);
    trigger.setFill(Color.WHITE);
    trigger.setStroke(Color.LIGHTGRAY);

    DropShadow shadow = new DropShadow();
    shadow.setRadius(2);
    trigger.setEffect(shadow);

    translateAnimation.setNode(trigger);
    fillAnimation.setShape(background);

    getChildren().addAll(background, trigger);

    switchedOn.addListener((obs, oldState, newState) -> {
        boolean isOn = newState.booleanValue();
        translateAnimation.setToX(isOn ? 100 - 50 : 0);
        fillAnimation.setFromValue(isOn ? Color.WHITE : Color.LIGHTGREEN);
        fillAnimation.setToValue(isOn ? Color.LIGHTGREEN : Color.WHITE);

        animation.play();
    });

    setOnMouseClicked(event -> {
        switchedOn.set(!switchedOn.get());
    });
}
 
Example #17
Source File: SpaceRunnerApp.java    From FXGLGames with MIT License 5 votes vote down vote up
private void nextLevel() {
    uiTextLevel.setVisible(false);

    inc("level", +1);

    level = new Level();
    level.spawnNewWave();

    Text textLevel = getUIFactory().newText("Level " + geti("level"), Color.WHITE, 22);
    textLevel.setEffect(new DropShadow(7, Color.BLACK));
    textLevel.setOpacity(0);

    centerText(textLevel);
    textLevel.setTranslateY(250);

    addUINode(textLevel);

    animationBuilder()
            .interpolator(Interpolators.SMOOTH.EASE_OUT())
            .duration(Duration.seconds(1.66))
            .onFinished(() -> {
                animationBuilder()
                        .duration(Duration.seconds(1.66))
                        .interpolator(Interpolators.EXPONENTIAL.EASE_IN())
                        .onFinished(() -> {
                            removeUINode(textLevel);
                            uiTextLevel.setVisible(true);
                        })
                        .translate(textLevel)
                        .from(new Point2D(textLevel.getTranslateX(), textLevel.getTranslateY()))
                        .to(new Point2D(330, 540))
                        .buildAndPlay();
            })
            .fadeIn(textLevel)
            .buildAndPlay();
}
 
Example #18
Source File: JFXButtonSkin.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
ButtonClickTransition(Node node, DropShadow shadowEffect) {
    super(node, new Timeline(
            new KeyFrame(Duration.ZERO,
                new KeyValue(shadowEffect.radiusProperty(),
                    JFXDepthManager.getShadowAt(2).radiusProperty().get(),
                    Interpolator.EASE_BOTH),
                new KeyValue(shadowEffect.spreadProperty(),
                    JFXDepthManager.getShadowAt(2).spreadProperty().get(),
                    Interpolator.EASE_BOTH),
                new KeyValue(shadowEffect.offsetXProperty(),
                    JFXDepthManager.getShadowAt(2).offsetXProperty().get(),
                    Interpolator.EASE_BOTH),
                new KeyValue(shadowEffect.offsetYProperty(),
                    JFXDepthManager.getShadowAt(2).offsetYProperty().get(),
                    Interpolator.EASE_BOTH)
            ),
            new KeyFrame(Duration.millis(1000),
                new KeyValue(shadowEffect.radiusProperty(),
                    JFXDepthManager.getShadowAt(5).radiusProperty().get(),
                    Interpolator.EASE_BOTH),
                new KeyValue(shadowEffect.spreadProperty(),
                    JFXDepthManager.getShadowAt(5).spreadProperty().get(),
                    Interpolator.EASE_BOTH),
                new KeyValue(shadowEffect.offsetXProperty(),
                    JFXDepthManager.getShadowAt(5).offsetXProperty().get(),
                    Interpolator.EASE_BOTH),
                new KeyValue(shadowEffect.offsetYProperty(),
                    JFXDepthManager.getShadowAt(5).offsetYProperty().get(),
                    Interpolator.EASE_BOTH)
            )
        )
    );
    // reduce the number to increase the shifting , increase number to reduce shifting
    setCycleDuration(Duration.seconds(0.2));
    setDelay(Duration.seconds(0));
}
 
Example #19
Source File: ChangeListenerSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private static Group createBean(double rotate, double translateX, double translateY) {
    javafx.scene.shape.Ellipse bean1 = new javafx.scene.shape.Ellipse(16, 10);
    javafx.scene.shape.Ellipse bean1end = new javafx.scene.shape.Ellipse( 4,3, 3.2, 1.8);
    bean1end.setFill(Color.WHITESMOKE);
    bean1.setFill(Color.BROWN);
    javafx.scene.Group group = new javafx.scene.Group(bean1, bean1end);
    group.setRotate(rotate);
    group.setTranslateX(translateX+57);
    group.setTranslateY(translateY+57);
    DropShadow dropShadow = new DropShadow();
    dropShadow.setOffsetX(2);
    dropShadow.setOffsetY(3);
    group.setEffect(dropShadow);
    return group;
}
 
Example #20
Source File: SerializableDropShadow.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
public DropShadow getDropShadow() {
    DropShadow shadow = new DropShadow();
    if (use) {
        shadow.setColor(getColor());
    } else {
        shadow.setColor(Color.TRANSPARENT);
    }
    shadow.setOffsetX(getOffsetX());
    shadow.setOffsetY(getOffsetY());
    shadow.setSpread(getSpread());
    shadow.setRadius(getRadius());
    shadow.setBlurType(BlurType.GAUSSIAN);
    return shadow;
}
 
Example #21
Source File: ThingView.java    From narjillos with MIT License 5 votes vote down vote up
private Effect getHaloEffect(double zoomLevel) {
	double minZoomLevel = 0.2;
	if (zoomLevel <= minZoomLevel)
		return null;
	double alpha = (zoomLevel - minZoomLevel) * 2.5;
	double limitedAlpha = Math.max(0, Math.min(1, alpha));
	Color color = new Color(0.9, 0.9, 0.9, limitedAlpha);
	return new DropShadow(20, 7, 7, color);
}
 
Example #22
Source File: KeyStrokeMotion.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public LettersPane() {
    setId("LettersPane");
    setPrefSize(480,480);
    setFocusTraversable(true);
    setOnMousePressed(new EventHandler<MouseEvent>() {
        
        @Override public void handle(MouseEvent me) {
            requestFocus();
            me.consume();
        }
    });
    setOnKeyPressed(new EventHandler<KeyEvent>() {
        
        @Override public void handle(KeyEvent ke) {
            createLetter(ke.getText());
            ke.consume();
        }
    });
    // create press keys text
    pressText = new Text("Press Keys");
    pressText.setTextOrigin(VPos.TOP);
    pressText.setFont(new Font(Font.getDefault().getFamily(), 40));
    pressText.setLayoutY(5);
    pressText.setFill(Color.rgb(80, 80, 80));
    DropShadow effect = new DropShadow();
    effect.setRadius(0);
    effect.setOffsetY(1);
    effect.setColor(Color.WHITE);
    pressText.setEffect(effect);
    getChildren().add(pressText);
}
 
Example #23
Source File: SignalTowerSkin.java    From Enzo with Apache License 2.0 5 votes vote down vote up
private void initGraphics() {
    green = new Region();
    green.getStyleClass().setAll("green");

    yellow = new Region();
    yellow.getStyleClass().setAll("yellow");

    red = new Region();
    red.getStyleClass().setAll("red");

    rack = new Region();
    rack.getStyleClass().setAll("rack");

    bodyDropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.web("0x000000a6"), 0.0133333333 * PREFERRED_WIDTH, 1.0, 0d, 2d);

    bodyInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.web("0x000000a6"), 0.0133333333 * PREFERRED_WIDTH, 1.0, 1.4142135623730951, 1.4142135623730951);
    bodyInnerShadow.setInput(bodyDropShadow);

    body = new Region();
    body.getStyleClass().setAll("body");
    body.setEffect(bodyInnerShadow);

    roof = new Region();
    roof.getStyleClass().setAll("roof");

    pane = new Pane();
    pane.getChildren().setAll(green,
                              yellow,
                              red,
                              rack,
                              body,
                              roof);

    getChildren().setAll(pane);
    resize();
}
 
Example #24
Source File: BasicView.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static void updateShapeAppearance( Shape shape, boolean selected ) {
    if ( shape == null ) return;

    shape.setFill(selected ? Color.LIGHTGREEN : Color.LIGHTBLUE);
    shape.setStroke(Color.DARKGRAY);
    shape.setStrokeWidth(2.5);

    DropShadow shadow = new DropShadow();
    shadow.setOffsetY(3.0);
    shadow.setOffsetX(3.0);
    shadow.setColor(Color.GRAY);
    shape.setEffect(shadow);
}
 
Example #25
Source File: Main.java    From FXTutorials with MIT License 5 votes vote down vote up
public MenuItem(String name) {
    Rectangle bg = new Rectangle(300, 24);

    LinearGradient gradient = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[] {
            new Stop(0, Color.BLACK),
            new Stop(0.2, Color.DARKGREY)
    });

    bg.setFill(gradient);
    bg.setVisible(false);
    bg.setEffect(new DropShadow(5, 0, 5, Color.BLACK));

    Text text = new Text(name + "      ");
    text.setFill(Color.LIGHTGREY);
    text.setFont(Font.font(20));

    setAlignment(Pos.CENTER_RIGHT);
    getChildren().addAll(bg, text);

    setOnMouseEntered(event -> {
        bg.setVisible(true);
        text.setFill(Color.WHITE);
    });

    setOnMouseExited(event -> {
        bg.setVisible(false);
        text.setFill(Color.LIGHTGREY);
    });

    setOnMousePressed(event -> {
        bg.setFill(Color.WHITE);
        text.setFill(Color.BLACK);
    });

    setOnMouseReleased(event -> {
        bg.setFill(gradient);
        text.setFill(Color.WHITE);
    });
}
 
Example #26
Source File: JFXDepthManager.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
/**
 * this method is used to add shadow effect to the node,
 * however the shadow is not real ( gets affected with node transformations)
 * <p>
 * use {@link #createMaterialNode(Node, int)} instead to generate a real shadow
 */
public static void setDepth(Node control, int level) {
    level = level < 0 ? 0 : level;
    level = level > 5 ? 5 : level;
    control.setEffect(new DropShadow(BlurType.GAUSSIAN,
        depth[level].getColor(),
        depth[level].getRadius(),
        depth[level].getSpread(),
        depth[level].getOffsetX(),
        depth[level].getOffsetY()));
}
 
Example #27
Source File: FxUtils.java    From stagedisplayviewer with MIT License 5 votes vote down vote up
public Text createLowerKey() {
    Text lowerKey = new Text();
    lowerKey.setFont(Font.font(FONT_FAMILY.toString(), FontWeight.MEDIUM, MAX_FONT_SIZE.toInt()));
    lowerKey.setFill(Color.WHITE);
    lowerKey.setWrappingWidth(getWrappingWidth());
    lowerKey.setTextAlignment(getAlignment());
    DropShadow ds = new DropShadow();
    ds.setOffsetY(0.0);
    ds.setOffsetX(0.0);
    ds.setColor(Color.BLACK);
    ds.setSpread(0.5);
    lowerKey.setEffect(ds);
    return lowerKey;
}
 
Example #28
Source File: Transaction.java    From constellation with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the selected state of this timeline, and if <code>true</code>,
 * visually updates the transaction with a 'glow'.
 *
 * @param selected Whether the transaction is currently selected.
 */
public void setSelected(final boolean selected) {
    isSelected = selected;

    if (isSelected) {
        this.setEffect(new DropShadow(BlurType.GAUSSIAN, Color.RED, 15.0, 0.45, 0.0, 0.0));
    } else {
        // Remove the selection effect:
        this.setEffect(null);
    }
}
 
Example #29
Source File: ReceiveMoneyRequestController.java    From thunder with GNU Affero General Public License v3.0 5 votes vote down vote up
public void update () {

        PaymentRequest paymentRequest = Main.thunderContext.receivePayment(getAmount());

        try {

            byte[] payload = paymentRequest.getPayload();

            FieldAddress.setText(Tools.bytesToHex(payload));
            FieldHash.setText(Tools.bytesToHex(paymentRequest.paymentSecret.hash));

            System.out.println(Tools.bytesToHex(payload));

            final byte[] imageBytes = QRCode
                    .from(Tools.bytesToHex(payload))
                    .withSize(250, 250)
                    .to(ImageType.PNG)
                    .stream()
                    .toByteArray();

            Image qrImage = new Image(new ByteArrayInputStream(imageBytes));
            ImageQR.setImage(qrImage);
            ImageQR.setEffect(new DropShadow());

            StringSelection stringSelection = new StringSelection(Tools.bytesToHex(payload));
            Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();
            clpbrd.setContents(stringSelection, null);

        } catch (Exception e) {
            e.printStackTrace();
        }

    }
 
Example #30
Source File: Civ6Title.java    From FXTutorials with MIT License 5 votes vote down vote up
public Civ6Title(String name) {
    String spread = "";
    for (char c : name.toCharArray()) {
        spread += c + " ";
    }

    text = new Text(spread);
    text.setFont(Font.loadFont(Civ6MenuApp.class.getResource("res/Penumbra-HalfSerif-Std_35114.ttf").toExternalForm(), 48));
    text.setFill(Color.WHITE);
    text.setEffect(new DropShadow(30, Color.BLACK));

    getChildren().addAll(text);
}