Search in sources :

Example 6 with DropShadow

use of javafx.scene.effect.DropShadow in project CapsLock by chrootRISCassembler.

the class MainFormController method onPanelClicked.

void onPanelClicked(MouseEvent event) {
    // 右クリックじゃない
    if (!event.getButton().equals(MouseButton.PRIMARY))
        return;
    // クリックされたパネルの取得
    final ImageView view = (ImageView) event.getSource();
    // パネルが示すゲーム
    final Game NextGame = (Game) view.getUserData();
    if (game != NextGame) {
        PanelTilePane.getChildren().stream().peek(panel -> panel.setScaleX(1)).peek(panel -> panel.setScaleY(1)).forEach(panel -> panel.setEffect(null));
        {
            // 選択されたパネルにエフェクトを適応
            view.setScaleX(1.15);
            view.setScaleY(1.15);
            // 影つけて
            final DropShadow effect = new DropShadow(20, Color.BLUE);
            // 光らせる
            effect.setInput(new Glow(0.5));
            view.setEffect(effect);
        }
        game = NextGame;
        Logger.INST.debug("ContentsAreaController#setGame() call");
        contentsAreaController.setGame(game);
        {
            final String name = NextGame.getName();
            NameLabel.setText("[P-" + NextGame.getGameID() + "]" + name);
        }
        if (NextGame.getDesc() == null) {
            Logger.INST.debug("No desc!");
        }
        DescriptionLabel.setText(NextGame.getDesc());
        DescriptionLabel.setPadding(Insets.EMPTY);
        DescriptionLabel.autosize();
    }
    // ダブルクリックじゃない
    if (event.getClickCount() != 2)
        return;
    handler.launch(game);
}
Also used : Button(javafx.scene.control.Button) MouseButton(javafx.scene.input.MouseButton) Glow(javafx.scene.effect.Glow) MouseEvent(javafx.scene.input.MouseEvent) StackPane(javafx.scene.layout.StackPane) VBox(javafx.scene.layout.VBox) MediaView(javafx.scene.media.MediaView) Insets(javafx.geometry.Insets) ScrollPane(javafx.scene.control.ScrollPane) Logger(methg.commonlib.trivial_logger.Logger) Tooltip(javafx.scene.control.Tooltip) Path(java.nio.file.Path) Color(javafx.scene.paint.Color) Rectangle2D(javafx.geometry.Rectangle2D) Label(javafx.scene.control.Label) Node(javafx.scene.Node) Font(javafx.scene.text.Font) Screen(javafx.stage.Screen) DropShadow(javafx.scene.effect.DropShadow) Collectors(java.util.stream.Collectors) FXML(javafx.fxml.FXML) ActionEvent(javafx.event.ActionEvent) List(java.util.List) Game(capslock.game_info.Game) TilePane(javafx.scene.layout.TilePane) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image) Collections(java.util.Collections) Game(capslock.game_info.Game) ImageView(javafx.scene.image.ImageView) Glow(javafx.scene.effect.Glow) DropShadow(javafx.scene.effect.DropShadow)

Example 7 with DropShadow

use of javafx.scene.effect.DropShadow in project tilesfx by HanSolo.

the class RadarChart method initGraphics.

private void initGraphics() {
    stops = new ArrayList<>(16);
    for (Stop stop : getGradientStops()) {
        if (Double.compare(stop.getOffset(), 0.0) == 0)
            stops.add(new Stop(0, stop.getColor()));
        stops.add(new Stop(stop.getOffset() * 0.69924 + 0.285, stop.getColor()));
    }
    chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    chartCtx = chartCanvas.getGraphicsContext2D();
    overlayCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    overlayCtx = overlayCanvas.getGraphicsContext2D();
    unitText = new Text(getUnit());
    unitText.setTextAlignment(TextAlignment.CENTER);
    unitText.setTextOrigin(VPos.CENTER);
    unitText.setFont(Fonts.latoLight(0.045 * PREFERRED_WIDTH));
    legendStep = (getMaxValue() - getMinValue()) / 5d;
    dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 5, 0, 0, 0);
    minValueText = new Text(String.format(Locale.US, formatString, getMinValue()));
    minValueText.setTextAlignment(TextAlignment.CENTER);
    minValueText.setTextOrigin(VPos.CENTER);
    minValueText.setVisible(isLegendVisible());
    minValueText.setEffect(dropShadow);
    legend1Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep));
    legend1Text.setTextAlignment(TextAlignment.CENTER);
    legend1Text.setTextOrigin(VPos.CENTER);
    legend1Text.setVisible(isLegendVisible());
    legend1Text.setEffect(dropShadow);
    legend2Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 2));
    legend2Text.setTextAlignment(TextAlignment.CENTER);
    legend2Text.setTextOrigin(VPos.CENTER);
    legend2Text.setVisible(isLegendVisible());
    legend2Text.setEffect(dropShadow);
    legend3Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 3));
    legend3Text.setTextAlignment(TextAlignment.CENTER);
    legend3Text.setTextOrigin(VPos.CENTER);
    legend3Text.setVisible(isLegendVisible());
    legend3Text.setEffect(dropShadow);
    legend4Text = new Text(String.format(Locale.US, formatString, getMinValue() + legendStep * 3));
    legend4Text.setTextAlignment(TextAlignment.CENTER);
    legend4Text.setTextOrigin(VPos.CENTER);
    legend4Text.setVisible(isLegendVisible());
    legend4Text.setEffect(dropShadow);
    maxValueText = new Text(String.format(Locale.US, formatString, getMaxValue()));
    maxValueText.setTextAlignment(TextAlignment.CENTER);
    maxValueText.setTextOrigin(VPos.CENTER);
    maxValueText.setVisible(isLegendVisible());
    maxValueText.setEffect(dropShadow);
    // Add all nodes
    pane = new Pane(chartCanvas, overlayCanvas, unitText, minValueText, legend1Text, legend2Text, legend3Text, legend4Text, maxValueText);
    pane.setBackground(new Background(new BackgroundFill(getChartBackgroundColor(), new CornerRadii(1024), Insets.EMPTY)));
    getChildren().setAll(pane);
}
Also used : Background(javafx.scene.layout.Background) Stop(javafx.scene.paint.Stop) Canvas(javafx.scene.canvas.Canvas) BackgroundFill(javafx.scene.layout.BackgroundFill) Text(javafx.scene.text.Text) CornerRadii(javafx.scene.layout.CornerRadii) Pane(javafx.scene.layout.Pane) DropShadow(javafx.scene.effect.DropShadow)

Example 8 with DropShadow

use of javafx.scene.effect.DropShadow in project latexdraw by arnobl.

the class LaTeXDraw method showSplash.

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();
    // NON-NLS
    final Image img = new Image("res/LaTeXDrawSmall.png");
    final ImageView splash = new ImageView(img);
    splashLayout.getChildren().addAll(splash, loadProgress);
    splashLayout.setEffect(new DropShadow());
    loadProgress.setPrefWidth(img.getWidth());
    task.stateProperty().addListener((observableValue, oldState, newState) -> {
        if (newState == Worker.State.SUCCEEDED) {
            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.initStyle(StageStyle.UNDECORATED);
    initStage.setScene(splashScene);
    // NON-NLS
    initStage.getIcons().add(new Image("/res/LaTeXDrawIcon.png"));
    initStage.centerOnScreen();
    initStage.toFront();
    initStage.show();
}
Also used : FadeTransition(javafx.animation.FadeTransition) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image) Scene(javafx.scene.Scene) ProgressBar(javafx.scene.control.ProgressBar) Pane(javafx.scene.layout.Pane) VBox(javafx.scene.layout.VBox) DropShadow(javafx.scene.effect.DropShadow)

Example 9 with DropShadow

use of javafx.scene.effect.DropShadow in project Malai by arnobl.

the class Pencil method configureBindings.

@Override
protected void configureBindings() {
    // A DnD interaction with the left button of the mouse will produce an AddShape command while interacting on the canvas.
    // A temporary view of the created shape is created and displayed by the canvas.
    // This view is removed at the end of the interaction.
    nodeBinder(new DnD(), i -> new AddShape(drawing, new MyRect(i.getSrcLocalPoint().getX(), i.getSrcLocalPoint().getY()))).on(canvas).first((i, c) -> canvas.setTmpShape(ViewFactory.INSTANCE.createViewShape(c.getShape()))).then((i, c) -> {
        final MyRect sh = (MyRect) c.getShape();
        sh.setWidth(i.getTgtLocalPoint().getX() - sh.getX());
        sh.setHeight(i.getTgtLocalPoint().getY() - sh.getY());
    }).when(i -> i.getButton() == MouseButton.PRIMARY).end((i, c) -> canvas.setTmpShape(null)).log(LogLevel.INTERACTION).strictStart().help(new AddRectHelpAnimation(learningPane, canvas)).bind();
    // A DnD interaction with the right button of the mouse moves the targeted shape.
    // To incrementally moves the shape, the DnD interaction has its parameter 'updateSrcOnUpdate' set to true:
    // At each interaction updates, the source point and object take the latest target point and object.
    // The DnD interaction can be stopped (aborted) by pressing the key 'ESC'. This cancels the ongoing command (that thus needs to be undoable).
    nodeBinder(new DnD(true, true), // In the command these binding are @autoUnbind to be unbound on their command termination.
    i -> {
        final MyShape sh = i.getSrcObject().map(o -> (MyShape) o.getUserData()).get();
        return new MoveShape(sh, Bindings.createDoubleBinding(() -> sh.getX() + (i.getTgtScenePoint().getX() - i.getSrcScenePoint().getX()), i.tgtScenePointProperty(), i.srcScenePointProperty()), Bindings.createDoubleBinding(() -> sh.getY() + (i.getTgtScenePoint().getY() - i.getSrcScenePoint().getY()), i.tgtScenePointProperty(), i.srcScenePointProperty()));
    }).on(canvas.getShapesPane().getChildren()).when(i -> i.getButton() == MouseButton.SECONDARY).exec().first((i, c) -> {
        // Required to grab the focus to get key events
        Platform.runLater(() -> i.getSrcObject().get().requestFocus());
        i.getSrcObject().get().setEffect(new DropShadow(20d, Color.BLACK));
    }).endOrCancel((i, c) -> i.getSrcObject().get().setEffect(null)).strictStart().help(new MoveRectHelpAnimation(learningPane, canvas)).throttle(40L).bind();
    // nodeBinder(new DnD(true, true), i -> new MoveShape(i.getSrcObject().map(o ->(MyShape) o.getUserData()).orElse(null))).
    // // The binding dynamically registers elements of the given observable list.
    // // When nodes are added to this list, these nodes register the binding.
    // // When nodes are removed from this list, their binding is cancelled.
    // // This permits to interact on nodes (here, shapes) that are dynamically added to/removed from the canvas.
    // on(canvas.getShapesPane().getChildren()).
    // then((i, c) -> c.setCoord(c.getShape().getX() + (i.getTgtScenePoint().getX() - i.getSrcScenePoint().getX()),
    // c.getShape().getY() + (i.getTgtScenePoint().getY() - i.getSrcScenePoint().getY()))).
    // when(i -> i.getButton() == MouseButton.SECONDARY).
    // // exec(true): this allows to execute the command each time the interaction updates (and 'when' is true).
    // exec(true).
    // first((i, c) -> {
    // // Required to grab the focus to get key events
    // Platform.runLater(() -> i.getSrcObject().get().requestFocus());
    // i.getSrcObject().get().setEffect(new DropShadow(20d, Color.BLACK));
    // }).
    // end((i, c) -> i.getSrcObject().get().setEffect(null)).
    // strictStart().
    // bind();
    /*
		 * A DnD on the colour picker produces ChangeCol commands when the target of the DnD is a shape
		 * (the shape we want to change the colour). The interim feedback changes the cursor during the DnD to show the dragged colour.
		 * Note that the feedback callback is not optimised here as the colour does not change during the DnD. The cursor
		 * should be changed in 'first'
		 */
    nodeBinder(new DnD(), i -> new ChangeColour(lineCol.getValue(), null)).on(lineCol).then((i, c) -> i.getTgtObject().map(view -> (MyShape) view.getUserData()).ifPresent(sh -> c.setShape(sh))).when(i -> i.getTgtObject().orElse(null) instanceof Shape).feedback(() -> lineCol.getScene().setCursor(new ColorCursor(lineCol.getValue()))).endOrCancel((a, i) -> lineCol.getScene().setCursor(Cursor.DEFAULT)).bind();
    /*
		 * A mouse pressure creates an anonymous command that simply shows a message in the console.
		 */
    anonCmdBinder(new Press(), () -> System.out.println("An example of the anonymous command.")).on(canvas).bind();
    /*
		 * A widget binding that execute a command asynchronously.
		 * Widgets and properties are provided to the binding to:
		 * show/hide the cancel button, provide widgets with information regarding the progress of the command execution.
		 */
    buttonBinder(Save::new).on(save).async(cancel, progressbar.progressProperty(), textProgress.textProperty()).bind();
}
Also used : Button(javafx.scene.control.Button) AddShape(org.malai.ex.draw.command.AddShape) Initializable(javafx.fxml.Initializable) MouseButton(javafx.scene.input.MouseButton) MyCanvas(org.malai.ex.draw.view.MyCanvas) MyDrawing(org.malai.ex.draw.model.MyDrawing) URL(java.net.URL) Bindings(javafx.beans.binding.Bindings) AddRectHelpAnimation(org.malai.ex.draw.learning.AddRectHelpAnimation) ProgressBar(javafx.scene.control.ProgressBar) MyRect(org.malai.ex.draw.model.MyRect) ResourceBundle(java.util.ResourceBundle) ListChangeListener(javafx.collections.ListChangeListener) MyShape(org.malai.ex.draw.model.MyShape) DnD(org.malai.javafx.interaction.library.DnD) Pane(javafx.scene.layout.Pane) Save(org.malai.ex.draw.command.Save) MoveRectHelpAnimation(org.malai.ex.draw.learning.MoveRectHelpAnimation) ColorPicker(javafx.scene.control.ColorPicker) LogLevel(org.malai.logging.LogLevel) Color(javafx.scene.paint.Color) Label(javafx.scene.control.Label) MoveShape(org.malai.ex.draw.command.MoveShape) ViewFactory(org.malai.ex.draw.view.ViewFactory) ChangeColour(org.malai.ex.draw.command.ChangeColour) JfxInstrument(org.malai.javafx.instrument.JfxInstrument) Group(javafx.scene.Group) Collectors(java.util.stream.Collectors) DropShadow(javafx.scene.effect.DropShadow) Objects(java.util.Objects) Platform(javafx.application.Platform) FXML(javafx.fxml.FXML) Cursor(javafx.scene.Cursor) Press(org.malai.javafx.interaction.library.Press) ColorCursor(org.malai.ex.util.ColorCursor) Shape(javafx.scene.shape.Shape) AddShape(org.malai.ex.draw.command.AddShape) MoveShape(org.malai.ex.draw.command.MoveShape) AddShape(org.malai.ex.draw.command.AddShape) MyShape(org.malai.ex.draw.model.MyShape) MoveShape(org.malai.ex.draw.command.MoveShape) Shape(javafx.scene.shape.Shape) MyRect(org.malai.ex.draw.model.MyRect) AddRectHelpAnimation(org.malai.ex.draw.learning.AddRectHelpAnimation) ChangeColour(org.malai.ex.draw.command.ChangeColour) MyShape(org.malai.ex.draw.model.MyShape) ColorCursor(org.malai.ex.util.ColorCursor) DropShadow(javafx.scene.effect.DropShadow) MoveRectHelpAnimation(org.malai.ex.draw.learning.MoveRectHelpAnimation) DnD(org.malai.javafx.interaction.library.DnD) Press(org.malai.javafx.interaction.library.Press)

Example 10 with DropShadow

use of javafx.scene.effect.DropShadow in project Board-Instrumentation-Framework by intel.

the class Led method recalc.

// ******************** Resize/Redraw *************************************
private void recalc() {
    double size = getWidth() < getHeight() ? getWidth() : getHeight();
    ledOffShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * size, 0, 0, 0);
    ledOnShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * size, 0, 0, 0);
    ledOnShadow.setInput(new DropShadow(BlurType.TWO_PASS_BOX, ledColor.get(), 0.36 * size, 0, 0, 0));
    frameGradient = new LinearGradient(0.14 * size, 0.14 * size, 0.84 * size, 0.84 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(20, 20, 20, 0.65)), new Stop(0.15, Color.rgb(20, 20, 20, 0.65)), new Stop(0.26, Color.rgb(41, 41, 41, 0.65)), new Stop(0.26, Color.rgb(41, 41, 41, 0.64)), new Stop(0.85, Color.rgb(200, 200, 200, 0.41)), new Stop(1.0, Color.rgb(200, 200, 200, 0.35)));
    ledOnGradient = new LinearGradient(0.25 * size, 0.25 * size, 0.74 * size, 0.74 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, ledColor.get().deriveColor(0d, 1d, 0.77, 1d)), new Stop(0.49, ledColor.get().deriveColor(0d, 1d, 0.5, 1d)), new Stop(1.0, ledColor.get()));
    ledOffGradient = new LinearGradient(0.25 * size, 0.25 * size, 0.74 * size, 0.74 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, ledColor.get().deriveColor(0d, 1d, 0.20, 1d)), new Stop(0.49, ledColor.get().deriveColor(0d, 1d, 0.13, 1d)), new Stop(1.0, ledColor.get().deriveColor(0d, 1d, 0.2, 1d)));
    highlightGradient = new RadialGradient(0, 0, 0.3 * size, 0.3 * size, 0.29 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.WHITE), new Stop(1.0, Color.TRANSPARENT));
    draw();
}
Also used : LinearGradient(javafx.scene.paint.LinearGradient) InnerShadow(javafx.scene.effect.InnerShadow) Stop(javafx.scene.paint.Stop) RadialGradient(javafx.scene.paint.RadialGradient) DropShadow(javafx.scene.effect.DropShadow)

Aggregations

DropShadow (javafx.scene.effect.DropShadow)40 Pane (javafx.scene.layout.Pane)18 InnerShadow (javafx.scene.effect.InnerShadow)17 Region (javafx.scene.layout.Region)13 Text (javafx.scene.text.Text)13 Canvas (javafx.scene.canvas.Canvas)9 Group (javafx.scene.Group)8 Label (javafx.scene.control.Label)8 ImageView (javafx.scene.image.ImageView)8 Rotate (javafx.scene.transform.Rotate)6 AnchorPane (javafx.scene.layout.AnchorPane)5 Color (javafx.scene.paint.Color)5 Stop (javafx.scene.paint.Stop)5 Image (javafx.scene.image.Image)4 RadialGradient (javafx.scene.paint.RadialGradient)4 FXML (javafx.fxml.FXML)3 ProgressBar (javafx.scene.control.ProgressBar)3 StackPane (javafx.scene.layout.StackPane)3 VBox (javafx.scene.layout.VBox)3 LinearGradient (javafx.scene.paint.LinearGradient)3