下面列出了怎么用javafx.scene.effect.DropShadow的API类实例代码及写法,或者点击链接到github查看源代码。
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);
}
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);
}
/**
* 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();
}
@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());
}
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
}
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);
}
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);
}
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;
}
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);
}
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);
}
@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;
}
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;
}
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;
}
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;
}
@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());
}
/**
* 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);
}
}
/**
* Update the current selection on the ScatterChart within this
* ScatterChartPane. This allows a primary selection (which will highlight
* in red) as well as a secondary selection (which will highlight in
* yellow).
*
* @param primarySelection the set of data objects representing the primary
* selection.
* @param secondarySelection the set of data objects representing the
* secondary selection.
*/
protected void selectElementsOnChart(final Set<ScatterData> primarySelection, final Set<ScatterData> secondarySelection) {
final DropShadow primarySelectionShadow = new DropShadow(BlurType.THREE_PASS_BOX, Color.RED, 20.0, 0.85, 0.0, 0.0);
final DropShadow secondarySelectionShadow = new DropShadow(BlurType.THREE_PASS_BOX, Color.YELLOW, 20.0, 0.85, 0.0, 0.0);
Platform.runLater(() -> {
synchronized (currentData) {
for (final ScatterData data : currentData) {
if (secondarySelection != null && secondarySelection.contains(data)) {
data.getData().getNode().setEffect(secondarySelectionShadow);
continue;
}
if (primarySelection != null && primarySelection.contains(data)) {
data.getData().getNode().setEffect(primarySelectionShadow);
continue;
}
@SuppressWarnings("unchecked") // getData will return data of type number and number
Data<Number, Number> data2 = (Data<Number, Number>) data.getData();
Node dataNode = data2.getNode();
dataNode.setEffect(null);
}
}
});
if (primarySelection != null && !currentSelectedData.equals(primarySelection)) {
currentSelectedData.clear();
currentSelectedData.addAll(primarySelection);
}
}
private void init() {
this.setCenter(rootPane);
this.setTitle("组件测试");
this.setWidth(380);
this.setHeight(600);
this.setRadius(10);
VBox topBox = new VBox();
topBox.setPrefHeight(50);
rootPane.setTop(topBox);
Image image = ImageBox.getImageClassPath("/images/head/101_100.gif");
ImageNode imageButton = new ImageNode();
imageButton.setImage(image);
imageButton.setImageSize(80);
imageButton.setImageRadius(20);
imageButton.setGray(true);
imageButton.setEffect(new DropShadow(20, Color.BLACK));
ImageView imageView = new ImageView();
imageView.setImage(image);
StackPane stackPane = new StackPane();
stackPane.getChildren().add(imageButton);
stackPane.setStyle("-fx-background-color:rgba(150,120,210,1)");
rootPane.setCenter(stackPane);
}
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();
}
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;
}
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());
});
}
public static Image addTextFx(Image image, String textString,
Font font, Color color, int x, int y, float transparent, int shadow) {
try {
Group group = new Group();
Text text = new Text(x, y, textString);
text.setFill(color);
text.setFont(font);
if (shadow > 0) {
DropShadow dropShadow = new DropShadow();
dropShadow.setOffsetX(shadow);
dropShadow.setOffsetY(shadow);
text.setEffect(dropShadow);
}
group.getChildren().add(text);
Blend blend = new Blend(BlendMode.SRC_OVER);
blend.setBottomInput(new ImageInput(image));
blend.setOpacity(1.0 - transparent);
group.setEffect(blend);
SnapshotParameters parameters = new SnapshotParameters();
parameters.setFill(Color.TRANSPARENT);
WritableImage newImage = group.snapshot(parameters, null);
return newImage;
} catch (Exception e) {
logger.error(e.toString());
return null;
}
}
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));
}
public TaskBarIcon(TaskBar taskBar, InternalWindow internalWindow) {
this.taskBar = taskBar;
this.internalWindow = internalWindow;
this.icon = internalWindow.getTitleBar().getIcon();
this.desktopPane = internalWindow.getDesktopPane();
getStyleClass().add("taskbar-icon");
setId(internalWindow.getId());
addEventHandler(MouseEvent.MOUSE_CLICKED, e -> restoreWindow());
HBox pane = new HBox();
pane.setStyle("-fx-alignment:center-left");
pane.setSpacing(10d);
pane.setPadding(new Insets(0, 10, 0, 10));
lblTitle = new Label();
lblTitle.textProperty().bind(internalWindow.getTitleBar().titleProperty());
btnClose = new Button("", new FontIcon(MaterialDesign.MDI_WINDOW_CLOSE));
btnClose.visibleProperty().bind(closeVisibleProperty());
btnClose.managedProperty().bind(closeVisibleProperty());
btnClose.disableProperty().bind(disableCloseProperty());
btnClose.getStyleClass().add("taskbar-icon-button");
//Adding the shadow when the mouse cursor is on
final DropShadow shadowCloseBtn = new DropShadow();
shadowCloseBtn.setHeight(10d);
shadowCloseBtn.setWidth(10d);
btnClose.addEventHandler(MouseEvent.MOUSE_ENTERED, e -> btnClose.setEffect(shadowCloseBtn));
//Removing the shadow when the mouse cursor is off
btnClose.addEventHandler(MouseEvent.MOUSE_EXITED, e -> btnClose.setEffect(null));
btnClose.addEventHandler(MouseEvent.MOUSE_CLICKED, e -> closeWindow());
pane.getChildren().addAll(icon, lblTitle, btnClose);
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
setGraphic(pane);
}
public static Node createIconContent() {
Text sample = new Text("FX");
sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,80));
sample.setStyle("-fx-font-size: 80px;");
sample.setFill(Color.web("#333333"));
final DropShadow dropShadow = new DropShadow();
dropShadow.setOffsetX(4);
dropShadow.setOffsetY(6);
dropShadow.setColor(Color.rgb(0,0,0,0.7));
sample.setEffect(dropShadow);
return sample;
}
private static Group createKey(String character, double x, double y) {
javafx.scene.text.Text text = new javafx.scene.text.Text(3, 2, character);
text.setFill(Color.WHITESMOKE);
text.setTextOrigin(javafx.geometry.VPos.TOP);
javafx.scene.shape.Rectangle rectangle = new javafx.scene.shape.Rectangle(20, 20);
rectangle.setStroke(Color.BLACK);
rectangle.setEffect(new DropShadow());
rectangle.setFill(Color.DARKGRAY);
rectangle.setArcHeight(7);
rectangle.setArcWidth(7);
javafx.scene.Group g = new javafx.scene.Group(rectangle, text);
g.setLayoutX(x);
g.setLayoutY(y);
return g;
}
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;
}
@Override
public void init() {
ImageView splash = new ImageView(BundleUtils.getFxImage("splash"));
loadProgress = new ProgressBar();
loadProgress.setPrefWidth(SPLASH_WIDTH);
progressText = new Label();
splashLayout = new VBox();
splashLayout.getChildren().addAll(splash, loadProgress, progressText);
progressText.setAlignment(Pos.CENTER);
splashLayout.getStylesheets().add(BundleUtils.getStylesheet("css_splash"));
splashLayout.setEffect(new DropShadow());
hostServices = new HostServices();
}
private void showSplash(final Stage initStage, final Task<Void> task) {
final ProgressBar loadProgress = new ProgressBar();
loadProgress.progressProperty().bind(task.progressProperty());
final Pane splashLayout = new VBox();
final Image img = new Image("res/LaTeXDrawSmall.png", 450, 250, true, true); //NON-NLS
final ImageView splash = new ImageView(img);
splashLayout.getChildren().addAll(splash, loadProgress);
splashLayout.setEffect(new DropShadow());
loadProgress.setPrefWidth(img.getWidth());
task.setOnSucceeded(ignore -> {
loadProgress.progressProperty().unbind();
loadProgress.setProgress(1d);
final FadeTransition fadeSplash = new FadeTransition(Duration.seconds(0.8), splashLayout);
fadeSplash.setFromValue(1d);
fadeSplash.setToValue(0d);
fadeSplash.setOnFinished(evt -> {
initStage.hide();
mainStage.setIconified(false);
mainStage.toFront();
});
fadeSplash.play();
});
final Scene splashScene = new Scene(splashLayout);
initStage.setScene(splashScene);
initStage.initStyle(StageStyle.UNDECORATED);
initStage.getIcons().add(new Image("/res/LaTeXDrawIcon.png")); //NON-NLS
initStage.centerOnScreen();
initStage.toFront();
initStage.show();
}
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));
}