public class ChatWindow extends Application { @Override public void start(final Stage stage) throws Exception { stage.initStyle(StageStyle.TRANSPARENT); // here it is Group rg = new Group(); Scene scene = new Scene(rg, 320, 240, Color.TRANSPARENT); stage.setScene(scene); stage.show(); Rectangle r = new Rectangle(5, 5, stage.getWidth() - 10, stage.getHeight() - 10); r.setFill(Color.STEELBLUE); r.setEffect(new DropShadow()); rg.getChildren().add(r); } public static void main(String[] args) { launch(); } }
/** * Set on/off the stage shadow effect * * @param b */ protected void setShadowFocused(boolean b) { // Do not change anything while maximized (in case of dialog closing for // instance) if (stage.isFullScreen()) { return; } if (maximizeProperty.get()) { return; } if (b) { shadowRectangle.setEffect(dsFocused); } else { shadowRectangle.setEffect(dsNotFocused); } }
/** * Switch the visibility of the window's drop shadow */ protected void setShadow(boolean shadow) { // Already removed? if (!shadow && shadowRectangle.getEffect() == null) { return; } // From fullscreen to maximize case if (shadow && maximizeProperty.get()) { return; } if (!shadow) { shadowRectangle.setEffect(null); SAVED_SHADOW_WIDTH = SHADOW_WIDTH; SHADOW_WIDTH = 0; } else { shadowRectangle.setEffect(dsFocused); SHADOW_WIDTH = SAVED_SHADOW_WIDTH; } }
public void setFill(Color color) { innerBar.setFill(color); DropShadow ds = new DropShadow(15, color); ds.setInput(new Glow(0.5)); innerBar.setEffect(ds); }
public void setFill(Color color) { innerBar.setFill(color); DropShadow ds = new DropShadow(15, color); ds.setInput(new Glow(0.5)); innerBar.setEffect(ds); }
rectangle.setArcHeight(4); rectangle.setArcWidth(6); rectangle.setEffect(new DropShadow());
/** * 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(); }
public static void startValueSetAnimation(final Pane parent) { final javafx.scene.shape.Rectangle rectangle = new javafx.scene.shape.Rectangle(); Insets margin = BorderPane.getMargin(parent); if (margin == null) { margin = new Insets(0); } rectangle.widthProperty().bind(parent.widthProperty().subtract(margin.getLeft() + margin.getRight())); rectangle.heightProperty().bind(parent.heightProperty().subtract(margin.getTop() + margin.getBottom())); rectangle.setFill(Color.rgb(0, 150, 201)); parent.getChildren().add(rectangle); BoxBlur bb = new BoxBlur(); bb.setWidth(5); bb.setHeight(5); bb.setIterations(3); rectangle.setEffect(bb); FadeTransition ft = new FadeTransition(Duration.millis(250), rectangle); ft.setFromValue(0.2); ft.setToValue(0.8); ft.setCycleCount(2); ft.setAutoReverse(true); ft.play(); ft.setOnFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { parent.getChildren().remove(rectangle); } }); }