Search in sources :

Example 76 with ImageView

use of javafx.scene.image.ImageView in project Zong by Xenoage.

the class PlayerFrame method createLanguageItems.

private void createLanguageItems() {
    // clear old menu items
    mnuSettingsLanguage.getItems().clear();
    // add language menu items
    List<LanguageInfo> langs = null;
    try {
        langs = LanguageInfo.getAvailableLanguages(LangManager.defaultLangPath);
    } catch (Exception ex) {
        handle(Companion.fatal(ex));
    }
    ToggleGroup toggleGroup = new ToggleGroup();
    for (final LanguageInfo lang : langs) {
        String name = lang.getLocalName();
        String intName = lang.getInternationalName();
        ImageView icon = null;
        if (lang.getFlag16Path() != null)
            icon = new ImageView(imageOrNull(lang.getFlag16Path()));
        String text = name + (name.equals(intName) ? "" : " (" + intName + ")");
        RadioMenuItem mnu = new RadioMenuItem(text, icon);
        mnu.setToggleGroup(toggleGroup);
        mnu.setOnAction(e -> app().execute(new LanguageChange(lang.getID())));
        if (Lang.getCurrentLanguage().getID().equals(lang.getID()))
            mnu.setSelected(true);
        mnu.setUserData(lang.getID());
        mnuSettingsLanguage.getItems().add(mnu);
    }
}
Also used : LanguageInfo(com.xenoage.utils.jse.lang.LanguageInfo) ImageView(javafx.scene.image.ImageView) IOException(java.io.IOException)

Example 77 with ImageView

use of javafx.scene.image.ImageView 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 78 with ImageView

use of javafx.scene.image.ImageView in project CapsLock by chrootRISCassembler.

the class MainFormController method ShufflePanels.

final void ShufflePanels() {
    System.out.println("Shuffle called");
    final int last = PanelTilePane.getChildren().size();
    final Node FirstView = PanelTilePane.getChildren().get(0);
    final List<Node> views = PanelTilePane.getChildren().subList(1, last).stream().map(node -> (ImageView) node).collect(Collectors.toList());
    PanelTilePane.getChildren().clear();
    Collections.shuffle(views);
    PanelTilePane.getChildren().add(FirstView);
    PanelTilePane.getChildren().addAll(views);
    System.out.println("shuffle end");
}
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) Node(javafx.scene.Node) ImageView(javafx.scene.image.ImageView)

Example 79 with ImageView

use of javafx.scene.image.ImageView in project latexdraw by arnobl.

the class ViewShape method getActivatedGroupNodes.

private static Collection<Shape> getActivatedGroupNodes(final Group gp) {
    // Adding all the shape children
    final Collection<Shape> shapes = gp.getChildren().stream().filter(node -> node instanceof Shape && node.isVisible() && !node.isDisable()).map(node -> (Shape) node).collect(Collectors.toList());
    // Adding all the view shape children
    shapes.addAll(gp.getChildren().stream().filter(node -> node instanceof ViewShape<?> && node.isVisible() && !node.isDisable()).map(vs -> ((ViewShape<?>) vs).getActivatedShapes()).flatMap(st -> st.stream()).collect(Collectors.toList()));
    // Adding the shapes contained in groups that are not view shapes
    shapes.addAll(gp.getChildren().stream().filter(node -> node instanceof Group && !(node instanceof ViewShape<?>)).map(node -> getActivatedGroupNodes((Group) node)).flatMap(st -> st.stream()).collect(Collectors.toList()));
    // Adding the images contained in the group
    shapes.addAll(gp.getChildren().stream().filter(node -> node instanceof ImageView && node.isVisible() && !node.isDisable()).map(node -> {
        final Bounds bounds = node.getBoundsInParent();
        Rectangle rec = new Rectangle(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight());
        rec.setFill(Color.WHITE);
        rec.getTransforms().setAll(gp.getLocalToSceneTransform());
        return rec;
    }).collect(Collectors.toList()));
    return shapes;
}
Also used : Platform(javafx.application.Platform) Parent(javafx.scene.Parent) Color(javafx.scene.paint.Color) IShape(net.sf.latexdraw.models.interfaces.shape.IShape) ImageView(javafx.scene.image.ImageView) Collection(java.util.Collection) Optional(java.util.Optional) Rectangle(javafx.scene.shape.Rectangle) Group(javafx.scene.Group) Collectors(java.util.stream.Collectors) Shape(javafx.scene.shape.Shape) Bounds(javafx.geometry.Bounds) Group(javafx.scene.Group) IShape(net.sf.latexdraw.models.interfaces.shape.IShape) Shape(javafx.scene.shape.Shape) Bounds(javafx.geometry.Bounds) Rectangle(javafx.scene.shape.Rectangle) ImageView(javafx.scene.image.ImageView)

Example 80 with ImageView

use of javafx.scene.image.ImageView 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)

Aggregations

ImageView (javafx.scene.image.ImageView)219 Image (javafx.scene.image.Image)98 Button (javafx.scene.control.Button)46 Label (javafx.scene.control.Label)44 Insets (javafx.geometry.Insets)36 Tooltip (javafx.scene.control.Tooltip)32 VBox (javafx.scene.layout.VBox)29 Scene (javafx.scene.Scene)28 File (java.io.File)26 ChangeListener (javafx.beans.value.ChangeListener)24 Node (javafx.scene.Node)21 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)20 AnchorPane (javafx.scene.layout.AnchorPane)20 Pane (javafx.scene.layout.Pane)20 StackPane (javafx.scene.layout.StackPane)20 Callback (javafx.util.Callback)20 BorderPane (javafx.scene.layout.BorderPane)18 HBox (javafx.scene.layout.HBox)18 ActionEvent (javafx.event.ActionEvent)17 FXML (javafx.fxml.FXML)17