/** * Draws the tooltip box. */ private void drawBox() { graphicsContext.setEffect(new DropShadow(10, 0, 2, Color.GREY)); graphicsContext.setFill(Color.WHITE); graphicsContext.fillRect(middleX - (DEFAULT_WIDTH / 2), belowY + 10, DEFAULT_WIDTH, height); graphicsContext.setEffect(null); graphicsContext.fillPolygon( new double[] {middleX, middleX - 10, middleX + 10}, new double[] {belowY, belowY + 10, belowY + 10}, 3 ); graphicsContext.setFill(HYGREEN); graphicsContext.fillRect( middleX - (DEFAULT_WIDTH / 2), belowY + LINE_HEIGHT + (height - BORDER_BOTTOM_HEIGHT), DEFAULT_WIDTH, BORDER_BOTTOM_HEIGHT ); }
/** * Modifies the GUI with minor fixes and styles. */ private void graphicMods() { taskListsScrollPane.setFitToWidth(true); tasksScrollPane.setFitToWidth(true); //Colors tasksScrollPane.setStyle("-fx-background-color: transparent;"); tasksAnchorPane.setStyle("-fx-background-color: white;"); //Effect for the title DropShadow shadow = new DropShadow(); shadow.setOffsetY(1.0); shadow.setOffsetX(1.0); shadow.setColor(Color.GRAY); titleTaskList.setEffect(shadow); }
@Override public void start(final Stage primaryStage) throws Exception { this.preloaderStage = primaryStage; final ImageView splash = new ImageView(new Image(Constant.IMG_DIR + "banner.png")); this.loadProgressPhase = new JFXProgressBar(); this.loadProgressPhase.setPrefWidth(Constant.SPLASH_WIDTH); this.splashLayout = new VBox(); this.splashLayout.getChildren().addAll(splash, this.loadProgressPhase); this.splashLayout.setStyle("-fx-padding: 5; " + "-fx-background-color: gainsboro; " + "-fx-border-width:2; " + "-fx-border-color: " + "linear-gradient(" + "to bottom, " + "MediumSeaGreen, " + "derive(MediumSeaGreen, 50%)" + ");"); this.splashLayout.setEffect(new DropShadow()); final Scene splashScene = new Scene(this.splashLayout, Color.TRANSPARENT); final Rectangle2D bounds = Screen.getPrimary().getBounds(); primaryStage.setScene(splashScene); primaryStage.setX(bounds.getMinX() + bounds.getWidth() / 2 - Constant.SPLASH_WIDTH / 2); primaryStage.setY(bounds.getMinY() + bounds.getHeight() / 2 - Constant.SPLASH_HEIGHT / 2); primaryStage.getIcons().add(new Image(Constant.IMG_DIR + "icon.png")); primaryStage.setTitle(Constant.APP_NAME); primaryStage.initStyle(StageStyle.UNDECORATED); primaryStage.setAlwaysOnTop(true); primaryStage.show(); }
@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()); }
private void update(ImageButton imageButton) { DropShadow rollOverColor = new DropShadow(); rollOverColor.setColor(Color.ORANGERED); DropShadow clickColor = new DropShadow(); clickColor.setColor(Color.DARKBLUE); imageButton.addEventHandler(MouseEvent.MOUSE_ENTERED, (event) -> imageButton.setEffect(rollOverColor)); // Removing the shadow when the mouse cursor is off imageButton.addEventHandler(MouseEvent.MOUSE_EXITED, (event) -> imageButton.setEffect(null)); // Darken shadow on click imageButton.addEventHandler(MouseEvent.MOUSE_PRESSED, (event) -> imageButton.setEffect(clickColor)); // Restore hover style on click end imageButton.addEventHandler(MouseEvent.MOUSE_RELEASED, (event) -> imageButton.setEffect(rollOverColor)); }
private static void setButtonEffect(Node node) { DropShadow rollOverColor = new DropShadow(); rollOverColor.setColor(Color.ORANGERED); DropShadow clickColor = new DropShadow(); clickColor.setColor(Color.DARKBLUE); node.addEventHandler(MouseEvent.MOUSE_ENTERED, (event) -> node.setEffect(rollOverColor)); // Removing the shadow when the mouse cursor is off node.addEventHandler(MouseEvent.MOUSE_EXITED, (event) -> node.setEffect(null)); // Darken shadow on click node.addEventHandler(MouseEvent.MOUSE_PRESSED, (event) -> node.setEffect(clickColor)); // Restore hover style on click end node.addEventHandler(MouseEvent.MOUSE_RELEASED, (event) -> node.setEffect(rollOverColor)); }
public void init() { ImageView splash = new ImageView(new Image( SPLASH_IMAGE )); loadProgress = new ProgressBar(); loadProgress.setPrefWidth(SPLASH_WIDTH - 20); loadProgress.setStyle("-fx-padding: 10; "); progressText = new Label("Loading Chess Bot"); splashLayout = new VBox(); splashLayout.getChildren().addAll(splash, loadProgress, progressText); progressText.setAlignment(Pos.CENTER); splashLayout.setStyle( "-fx-padding: 10; " + "-fx-background-color: white; " + "-fx-border-width:3; " + "-fx-border-color: " + "linear-gradient(" + "to bottom, " + "chocolate, " + "derive(chocolate, 50%)" + ");" ); splashLayout.setEffect(new DropShadow()); }
private void initializeHBox() { LoggerFacade.getDefault().trace(this.getClass(), "Initialize HBox"); // NOI18N super.setPadding(DEFAULT_PADDING); super.setSpacing(7.0d); super.setStyle("-fx-background-color:PALETURQUOISE; -fx-border-color: POWDERBLUE"); // NOI18N DropShadow dropShadow = new DropShadow(3.0d, 2.0d, 2.0d, Color.rgb(0, 0, 0, 0.6d)); super.setEffect(dropShadow); super.setOnMouseEntered((e) -> { this.onActionScaleToExpandedMode(); }); super.setOnMouseExited((e) -> { this.onActionScaleToNormalMode(); }); }
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); }
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); }
@Override public void init(Stage stage) { ImageView splash = new ImageView(new Image(Utils.IMG_DIR + "banner.png")); this.loadProgressPhase = new JFXProgressBar(); this.loadProgressPhase.setPrefWidth(GuiSplash.SPLASH_WIDTH); this.loadProgressItem = new JFXProgressBar(); this.loadProgressItem.setPrefWidth(GuiSplash.SPLASH_WIDTH); this.progressTextPhase = new Label(); this.progressTextItem = new Label(); this.splashLayout = new VBox(); this.splashLayout.getChildren().addAll(splash, this.loadProgressPhase, this.progressTextPhase, this.loadProgressItem, this.progressTextItem); this.progressTextPhase.setAlignment(Pos.CENTER); this.progressTextItem.setAlignment(Pos.CENTER); this.splashLayout.setStyle("-fx-padding: 5; " + "-fx-background-color: gainsboro; " + "-fx-border-width:2; " + "-fx-border-color: " + "linear-gradient(" + "to bottom, " + "MediumSeaGreen, " + "derive(MediumSeaGreen, 50%)" + ");"); this.splashLayout.setEffect(new 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); }
public TestNode setup() { TestNode rootTestNode = new TestNode(); final int heightPageContentPane = height; final int widthPageContentPane = width; // ======== DROP SHADOW ================= final PageWithSlots dropPage = new PageWithSlots(Pages.DropShadow.name(), heightPageContentPane, widthPageContentPane); dropPage.setSlotSize(125, 125); NamedEffect namedEffect = new slotDropShadow().getNamedEffectList().get(0); dropPage.add(new slotDropShadow(namedEffect),namedEffect.name); // ======== PerspectiveTransform ================= final PageWithSlots perspectiveTransformPage = new PageWithSlots(Pages.Transform.name(), heightPageContentPane, widthPageContentPane); perspectiveTransformPage.setSlotSize(140, 140); namedEffect = new slotPerspectiveTransform().getNamedEffectList().get(0); perspectiveTransformPage.add(new slotPerspectiveTransform(namedEffect),namedEffect.name); // ========= root tests list ============== rootTestNode.add(dropPage); rootTestNode.add(perspectiveTransformPage); return rootTestNode; }
List<NamedEffect> getNamedEffectList() { List<NamedEffect> nes = new ArrayList<NamedEffect>(); nes.add(new NamedEffect("default", new Lighting())); nes.add(new NamedEffect("distant light", new Lighting() {{ setLight(new Distant() {{ setAzimuth(90f); setElevation(50);}});}})); nes.add(new NamedEffect("point light", new Lighting() {{ setLight(new Point() {{ setX(70);setY(120);setZ(10);}});}})); nes.add(new NamedEffect("spot light", new Lighting() {{ setLight(new Spot() {{ setX(70);setY(120);setZ(50); setPointsAtX(150);setPointsAtY(0);setPointsAtZ(0); }});}})); nes.add(new NamedEffect("diffuse: 0.5", new Lighting() {{ setDiffuseConstant(0.5f);}})); nes.add(new NamedEffect("specularC: 1.5", new Lighting() {{ setSpecularConstant(1.5f);}})); nes.add(new NamedEffect("specularExp: 35", new Lighting() {{ setSpecularExponent(35f);}})); nes.add(new NamedEffect("scale: 7", new Lighting() {{ setSurfaceScale(7f);}})); nes.add(new NamedEffect("bump input", new Lighting() {{ setBumpInput(new DropShadow());}})); nes.add(new NamedEffect("content input", new Lighting() {{ setContentInput(new DropShadow());}})); return nes; }
public SplashScreen(Settings settings) { ImageView splash; width = (int) settings.get("splash-screen.width"); height = (int) settings.get("splash-screen.height"); image = FileUtils.getResourcePath("/img/SimulizerLogo.png"); splash = new ImageView(new Image(image, width, height, true, true)); Label progressText = new Label("Authors: Charlie Street, Kelsey McKenna, Matthew Broadway, Michael Oultram, Theo Styles\n" + "Version: " + BuildInfo.getInstance().VERSION_STRING + "\n" + BuildInfo.getInstance().REPO); layout = new VBox(); layout.getChildren().addAll(splash, progressText); progressText.setPadding(new Insets(5, 5, 5, 5)); progressText.setAlignment(Pos.BASELINE_CENTER); layout.getStyleClass().add("splashscreen"); layout.setEffect(new DropShadow()); delay = (int) settings.get("splash-screen.delay"); }
public ListViewPopup(List<T> items) { if (items != null) { setItems(items); } popup.getContent().add(searchListView); popup.setAutoHide(true); searchListView.getListView().setCellFactory((ListView<T> param) -> new ListCell<T>() { @Override protected void updateItem(T item, boolean empty) { super.updateItem(item, empty); setText(null); setGraphic(null); if (!empty && item != null) { setText(item.toString()); } } }); // 匹配检查的时候要用字符串转换器 searchListView.setPrefWidth(250); searchListView.setPrefHeight(250); searchListView.setEffect(new DropShadow()); }
public ComponentSearch(List<T> items) { if (items != null) { setComponents(items); } popup.getContent().add(componentView); popup.setAutoHide(true); componentView.getListView().setCellFactory((ListView<T> param) -> new ListCell<T>() { @Override protected void updateItem(T item, boolean empty) { super.updateItem(item, empty); if (empty) { setText(null); setGraphic(null); } else { setText(item.getId()); } } }); // 匹配检查的时候要用字符串转换器 componentView.setConverter((T t) -> t.getId()); componentView.setPrefWidth(250); componentView.setPrefHeight(250); componentView.setEffect(new DropShadow()); }
public DataProcessorSearch(List<T> items) { if (items != null) { setItems(items); } popup.getContent().add(searchListView); popup.setAutoHide(true); searchListView.getListView().setCellFactory((ListView<T> param) -> new ListCell<T>() { @Override protected void updateItem(T item, boolean empty) { super.updateItem(item, empty); if (empty) { setText(null); setGraphic(null); } else { setText(item.getData().getId()); } } }); // 匹配检查的时候要用字符串转换器 searchListView.setConverter((T t) -> t.getData().getId()); searchListView.setPrefWidth(250); searchListView.setPrefHeight(250); searchListView.setEffect(new DropShadow()); }
@Override public void init() { ImageView splash = new ImageView(new Image( SPLASH_IMAGE )); loadProgress = new ProgressBar(); loadProgress.setPrefWidth(SPLASH_WIDTH - 20); progressText = new Label("Will find friends for peanuts . . ."); splashLayout = new VBox(); splashLayout.getChildren().addAll(splash, loadProgress, progressText); progressText.setAlignment(Pos.CENTER); splashLayout.setStyle( "-fx-padding: 5; " + "-fx-background-color: cornsilk; " + "-fx-border-width:5; " + "-fx-border-color: " + "linear-gradient(" + "to bottom, " + "chocolate, " + "derive(chocolate, 50%)" + ");" ); splashLayout.setEffect(new DropShadow()); }
public MenuTitle(String name, int size, Color color, boolean useSpread) { String spread = ""; if (useSpread) { for (char c : name.toCharArray()) { spread += c + " "; } text = new Text(spread); text.setFont(Font.loadFont(MenuApp.class.getResource("/fonts/Penumbra-HalfSerif-Std_35114.ttf").toExternalForm(), size)); text.setEffect(new DropShadow(50, Color.BLACK)); } else { text = new Text(name); text.setFont(Font.font(null, FontWeight.LIGHT, size)); } text.setFill(color); text.setTextAlignment(TextAlignment.CENTER); getChildren().addAll(text); }
/** * @param name of the button * @param image node shown on the button */ private MenuButton(String name, Node image) { super(); Circle backing = new Circle(0, 0, 32, Color.GOLD); backing.setEffect(new DropShadow(20, 5, 5, Color.BLACK)); backing.setStroke(Color.BLACK); backing.setStrokeWidth(1); this.getChildren().addAll(backing, image); this.setPrefSize(64, 64); this.setPickOnBounds(false); this.wasPressed = false; this.addEventHandler(MouseEvent.MOUSE_PRESSED, this::onPress); this.addEventHandler(TouchEvent.TOUCH_PRESSED, this::onPress); this.addEventHandler(MouseEvent.MOUSE_RELEASED, this::onRelease); this.addEventHandler(TouchEvent.TOUCH_RELEASED, this::onRelease); }
private Scene createPreloaderScene() { splash = new ImageView(new Image(SPLASH_IMAGE)); loadProgress = new ProgressBar(); loadProgress.setPrefWidth(SPLASH_WIDTH); progressText = new Label(); progressText.setAlignment(Pos.CENTER); progressText.setStyle("-fx-font-weight: bold; -fx-fill: rgb(43,43,43);"); splashLayout = new VBox(10); splashLayout.getChildren().addAll(splash, loadProgress, progressText); splashLayout.setAlignment(Pos.CENTER); splashLayout.setPadding(new Insets(10, 5, 5, 5)); splash.setEffect(new DropShadow()); progressText.setEffect(new DropShadow(4, Color.rgb(133, 191, 37))); Scene scene = new Scene(splashLayout, SPLASH_WIDTH, SPLASH_HEIGHT, Color.TRANSPARENT); scene.getStylesheets().add("css/styles.css"); return scene; }
@Override public void init() { ImageView splash = new ImageView(new Image(SPLASH_IMAGE)); loadProgress = new ProgressBar(); loadProgress.setPrefWidth(SPLASH_WIDTH - 20); progressText = new Label("Will find friends for peanuts . . ."); splashLayout = new VBox(); splashLayout.getChildren().addAll(splash, loadProgress, progressText); progressText.setAlignment(Pos.CENTER); splashLayout.setStyle( "-fx-padding: 5; " + "-fx-background-color: cornsilk; " + "-fx-border-width:5; " + "-fx-border-color: " + "linear-gradient(" + "to bottom, " + "chocolate, " + "derive(chocolate, 50%)" + ");" ); splashLayout.setEffect(new DropShadow()); }
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); }
@Override public void init() { ImageView splash; try { splash = new ImageView(new Image(ClassLoader.getSystemResource(Constants.RSC_SPLASH_SCREEN_IMAGE).openStream())); } catch (IOException e) { LOGGER.error("Error reading logo file", e); splash = new ImageView(); } splashPane = new Pane(); splashPane.setStyle(Constants.CSS_FX_BACKGROUND_COLOR_TRANSPARENT); splashPane.getChildren().add(splash); splashPane.setCache(true); splashPane.setCacheHint(CacheHint.SPEED); splashPane.setEffect(new DropShadow()); }
private static Image generateBrokenHeartImage() { FontAwesomeIconView newHeart = new FontAwesomeIconView(FontAwesomeIcon.HEART); newHeart.setGlyphSize(graphicFontSize); FontAwesomeIconView newBolt = new FontAwesomeIconView(FontAwesomeIcon.BOLT); newBolt.setGlyphSize(graphicFontSize); newBolt.setScaleX(0.65); newBolt.setScaleY(0.65); newBolt.setTranslateX(-1.0); newHeart.setFill(brokenColor); newBolt.setFill(Color.WHITE); StackPane generated = new StackPane( newHeart, newBolt ); StackPane.setAlignment(newBolt, Pos.CENTER); StackPane.setAlignment(newHeart, Pos.CENTER); generated.setBlendMode(BlendMode.MULTIPLY); generated.setEffect( new DropShadow(BlurType.GAUSSIAN, heartDefaultColor, 7.0, 0.25, 0.0, 0.0)); return CellUtils.makeSnapshotWithTransparency(generated); }
private void setupNotificationIcon(Pane buttonHolder) { Label label = new AutoTooltipLabel(); label.textProperty().bind(model.numPendingTradesAsString); label.relocate(5, 1); label.setId("nav-alert-label"); ImageView icon = new ImageView(); icon.setLayoutX(0.5); icon.setId("image-alert-round"); Pane notification = new Pane(); notification.relocate(30, 9); notification.setMouseTransparent(true); notification.setEffect(new DropShadow(4, 1, 2, Color.GREY)); notification.getChildren().addAll(icon, label); notification.visibleProperty().bind(model.showPendingTradesNotification); buttonHolder.getChildren().add(notification); }
private void setupDisputesIcon(Pane buttonHolder) { Label label = new AutoTooltipLabel(); label.textProperty().bind(model.numOpenDisputesAsString); label.relocate(5, 1); label.setId("nav-alert-label"); ImageView icon = new ImageView(); icon.setLayoutX(0.5); icon.setId("image-alert-round"); Pane notification = new Pane(); notification.relocate(30, 9); notification.setMouseTransparent(true); notification.setEffect(new DropShadow(4, 1, 2, Color.GREY)); notification.getChildren().addAll(icon, label); notification.visibleProperty().bind(model.showOpenDisputesNotification); buttonHolder.getChildren().add(notification); }
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); }
@Override public void start(Stage primaryStage) throws Exception { Button button = new Button("BindableTransition"); DropShadow shadow = DropShadowBuilder.create().build(); button.setEffect(shadow); button.setStyle("-fx-font-size: 32px;"); final Duration duration = Duration.millis(1200); BindableTransition transition = new BindableTransition(duration); transition.setCycleCount(1000); transition.setAutoReverse(true); shadow.offsetXProperty().bind(transition.fractionProperty().multiply(32)); shadow.offsetYProperty().bind(transition.fractionProperty().multiply(32)); button.translateXProperty().bind(transition.fractionProperty().multiply(-32)); transition.play(); StackPane pane = new StackPane(); pane.getChildren().add(button); Scene myScene = new Scene(pane, 800, 600); primaryStage.setScene(myScene); primaryStage.show(); }
private Node gaussianBlur() { Text t2 = new Text(); t2.setX(10.0f); t2.setY(250.0f); t2.setCache(true); t2.setText("Gaussian Blur"); t2.setFill(Color.RED); t2.setFont(Font.font("null", FontWeight.BOLD, 36)); DropShadow shadow = new DropShadow(); shadow.setOffsetY(3.0); shadow.setOffsetX(3.0); shadow.setColor(Color.GRAY); shadow.setInput(new GaussianBlur()); Reflection rf = new Reflection(); rf.setFraction(1.5); rf.setInput(shadow); t2.setEffect(rf); return t2; }
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 }