Example usage for javafx.scene.image ImageView ImageView

List of usage examples for javafx.scene.image ImageView ImageView

Introduction

In this page you can find the example usage for javafx.scene.image ImageView ImageView.

Prototype

public ImageView(Image image) 

Source Link

Document

Allocates a new ImageView object using the given image.

Usage

From source file:org.sleuthkit.autopsy.imageanalyzer.gui.GroupPane.java

private MenuItem createGrpCatMenuItem(final Category cat) {
    final MenuItem menuItem = new MenuItem(cat.getDisplayName(),
            new ImageView(DrawableAttribute.CATEGORY.getIcon()));
    menuItem.setOnAction(new EventHandler<ActionEvent>() {
        @Override//from   ww  w . ja v  a2 s . co m
        public void handle(ActionEvent t) {
            selectAllFiles();
            new CategorizeAction().addTag(cat.getTagName(), "");

            grpCatSplitMenu.setText(cat.getDisplayName());
            grpCatSplitMenu.setOnAction(this);
        }
    });
    return menuItem;
}

From source file:org.sleuthkit.autopsy.imagegallery.gui.GroupPane.java

private MenuItem createGrpCatMenuItem(final Category cat) {
    final MenuItem menuItem = new MenuItem(cat.getDisplayName(),
            new ImageView(DrawableAttribute.CATEGORY.getIcon()));
    menuItem.setOnAction(new EventHandler<ActionEvent>() {
        @Override//ww w .  j  av  a  2 s. c  o  m
        public void handle(ActionEvent t) {
            Set<Long> fileIdSet = new HashSet<>(getGrouping().fileIds());
            new CategorizeAction().addTagsToFiles(cat.getTagName(), "", fileIdSet);

            grpCatSplitMenu.setText(cat.getDisplayName());
            grpCatSplitMenu.setOnAction(this);
        }
    });
    return menuItem;
}

From source file:Pages.LandingPage.java

public void loginPic() {

    image_user = new Image("Icons/login.jpg");
    background = new ImageView(image_user);
    background.setFitHeight(200);//w w w .j av  a 2s .  c om
    background.setFitWidth(400);
    background.relocate(0, 0);
    background.setStyle("-fx-background-radius:1em");

}

From source file:org.sleuthkit.autopsy.imageanalyzer.gui.GroupPane.java

private MenuItem createGrpTagMenuItem(final TagName tn) {
    final MenuItem menuItem = new MenuItem(tn.getDisplayName(),
            new ImageView(DrawableAttribute.TAGS.getIcon()));
    menuItem.setOnAction(new EventHandler<ActionEvent>() {
        @Override// w  w w. j a  v a2  s . c om
        public void handle(ActionEvent t) {
            selectAllFiles();
            AddDrawableTagAction.getInstance().addTag(tn, "");

            grpTagSplitMenu.setText(tn.getDisplayName());
            grpTagSplitMenu.setOnAction(this);
        }
    });
    return menuItem;
}

From source file:org.sleuthkit.autopsy.imagegallery.gui.GroupPane.java

private MenuItem createGrpTagMenuItem(final TagName tn) {
    final MenuItem menuItem = new MenuItem(tn.getDisplayName(),
            new ImageView(DrawableAttribute.TAGS.getIcon()));
    menuItem.setOnAction(new EventHandler<ActionEvent>() {
        @Override/*from w w w  .j a  va2  s  .co  m*/
        public void handle(ActionEvent t) {
            Set<Long> fileIdSet = new HashSet<>(getGrouping().fileIds());
            AddDrawableTagAction.getInstance().addTagsToFiles(tn, "", fileIdSet);

            grpTagSplitMenu.setText(tn.getDisplayName());
            grpTagSplitMenu.setOnAction(this);
        }
    });
    return menuItem;
}

From source file:photobooth.views.ExplorerPane.java

private void addPrevButton() throws IOException {
    Button button = new Button();
    button.setGraphic(//from   w w w. ja  va2 s.  c  om
            new ImageView(new Image(getClass().getResource("/photobooth/images/prev.png").openStream())));
    button.setStyle("-fx-background-radius: 50%; ");
    button.setStyle("-fx-background-color: transparent;");
    button.setLayoutX(10);
    button.setLayoutY(220);
    button.setMaxSize(50, 50);
    button.setMinSize(50, 50);
    this.getChildren().add(button);
    button.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            Global.getInstance().setSceneRoot(LoadingPane.getInstance());
            Platform.runLater(() -> {
                new Thread(new Runnable() {

                    @Override
                    public void run() {
                        ExplorerPane.getInstance().setDir(dir, offset - limit, limit, directoryLevel);
                        Global.getInstance().setSceneRoot(ExplorerPane.getInstance());
                    }
                }).start();
            });
        }
    });
}

From source file:Pages.LandingPage.java

public void profilePicture(String picture, Stage theStage) {
    // <editor-fold defaultstate="collapsed" desc="Circle Image">

    profile_pic = (new ImageView(new Image(picture)));
    Rectangle square = new Rectangle();
    square.setWidth(150);//from w w  w .  j  a  v a  2 s.c o  m
    square.setHeight(150);
    profile_pic.setClip(square);
    Circle clip = new Circle();
    clip.setCenterX(75);
    clip.setCenterY(75);
    clip.setRadius(75);
    profile_pic.fitWidthProperty().bind(square.widthProperty());
    profile_pic.fitHeightProperty().bind(square.heightProperty());
    profile_pic.setClip(clip);

    profile_pic.setOnMouseClicked(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent arg0) {
            createProfilePicture(theStage);
        }

    });

    userbox.getChildren().add(profile_pic);
    // </editor-fold>  
}

From source file:AudioPlayer3.java

private Button createPlayPauseButton() {
    URL url = getClass().getResource("resources/pause.png");
    pauseImg = new Image(url.toString());

    url = getClass().getResource("resources/play.png");
    playImg = new Image(url.toString());

    playPauseIcon = new ImageView(playImg);

    final Button playPauseButton = new Button(null, playPauseIcon);
    playPauseButton.setId("playPauseButton");
    playPauseButton.setOnAction(new EventHandler<ActionEvent>() {
        @Override//www.j  a  va2s .c  o m
        public void handle(ActionEvent arg0) {
            final MediaPlayer mediaPlayer = songModel.getMediaPlayer();
            if (mediaPlayer.getStatus() == MediaPlayer.Status.PLAYING) {
                mediaPlayer.pause();
            } else {
                mediaPlayer.play();
            }
        }
    });
    return playPauseButton;
}

From source file:com.heliosdecompiler.helios.gui.controller.FileTreeController.java

public void updateTree(List<TreeNode> add, List<TreeNode> remove) {
    Set<TreeItem<TreeNode>> updated = new HashSet<>();

    ArrayDeque<TreeNode> queue = new ArrayDeque<>();
    queue.addAll(add);/*from   w w w . j  a  v a 2 s. c  o m*/

    while (!queue.isEmpty()) {
        TreeNode thisNode = queue.pop();

        TreeItem<TreeNode> parent;

        if (thisNode.getParent() == null) {
            parent = rootItem;
        } else {
            parent = itemMap.get(thisNode.getParent());
        }

        updated.add(parent);

        TreeItem<TreeNode> thisItem = new TreeItem<>(thisNode);
        thisItem.addEventHandler(TreeItem.<TreeNode>branchExpandedEvent(), event -> {
            if (thisItem.getChildren().size() == 1) {
                thisItem.getChildren().get(0).setExpanded(true);
            }
        });
        thisItem.setGraphic(new ImageView(new Image(getIconForTreeItem(thisNode))));
        FutureTask<Void> call = new FutureTask<>(() -> {
            parent.getChildren().add(thisItem);
            return null;
        });
        Platform.runLater(call);
        try {
            call.get();
        } catch (InterruptedException | ExecutionException e) {
            e.printStackTrace();
        }

        itemMap.put(thisNode, thisItem);

        queue.addAll(thisNode.getChildren());
    }

    for (TreeItem<TreeNode> parent : updated) {
        if (parent.getChildren().size() > 1) {
            FutureTask<Void> call = new FutureTask<>(() -> {
                parent.getChildren().sort((a, b) -> {
                    int ac = a.getValue().getChildren().size();
                    int bc = b.getValue().getChildren().size();

                    if (ac == 0 && bc != 0)
                        return 1;
                    else if (ac != 0 && bc == 0)
                        return -1;
                    return a.getValue().getDisplayName().compareTo(b.getValue().getDisplayName());
                });
                return null;
            });
            Platform.runLater(call);
            try {
                call.get();
            } catch (InterruptedException | ExecutionException e) {
                e.printStackTrace();
            }
        }
    }

    queue.addAll(remove);

    while (!queue.isEmpty()) {
        TreeNode thisNode = queue.pop();
        TreeItem<TreeNode> thisItem = itemMap.remove(thisNode);
        thisItem.getParent().getChildren().remove(thisItem);
        queue.addAll(thisNode.getChildren());
    }
}

From source file:com.chart.SwingChart.java

/**
 * Copy to clipboard/*from   w ww  .ja  v a 2  s.com*/
 * @param node JavaFX Node to copy
 */
public final void copyClipboard(final Node node) {

    WritableImage captura = node.snapshot(new SnapshotParameters(), null);

    ImageView iv = new ImageView(captura);

    Clipboard clipboard = Clipboard.getSystemClipboard();
    ClipboardContent content = new ClipboardContent();
    content.put(DataFormat.IMAGE, captura);
    clipboard.setContent(content);

}