下面列出了javafx.scene.effect.DropShadow#setWidth ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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);
}
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 void setGlow(Node node) {
int depth = 70; //Setting the uniform variable for the glow width and height
borderGlow = new DropShadow();
borderGlow.setOffsetY(0f);
borderGlow.setOffsetX(0f);
if (theme == 7)
borderGlow.setColor(Color.ORANGE);
else
borderGlow.setColor(Color.BLUE);
borderGlow.setWidth(depth);
borderGlow.setHeight(depth);
node.setEffect(borderGlow);
}