Search in sources :

Example 6 with ImageView

use of javafx.scene.image.ImageView in project TeachingInSimulation by ScOrPiOzzy.

the class DrawingController method addDrawingPreviewBtn.

private void addDrawingPreviewBtn(final Resource resource) {
    String url = utils.getFullPath(ResourceConsts.FTP_RES_PATH + resource.getPath());
    Image image = new Image(url, 70, 70, true, true);
    ImageView view = new ImageView(image);
    ToggleButton toggle = new ToggleButton();
    toggle.setGraphic(view);
    toggle.getStyleClass().add("drawing-btn");
    toggle.setUserData(resource);
    ContextMenu menu = new ContextMenu();
    MenuItem item = new MenuItem(MsgUtil.getMessage("button.delete"));
    item.setOnAction(e -> {
        AlertUtil.showConfirm(stage, MsgUtil.getMessage("alert.confirmation.data.delete"), resp -> {
            if (ButtonType.YES == resp) {
                drawings.remove(String.valueOf(resource.getId()));
                refresh();
            }
        });
    });
    menu.getItems().add(item);
    toggle.setContextMenu(menu);
    group.getToggles().add(toggle);
    btns.getChildren().add(toggle);
}
Also used : ToggleButton(javafx.scene.control.ToggleButton) ContextMenu(javafx.scene.control.ContextMenu) MenuItem(javafx.scene.control.MenuItem) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image)

Example 7 with ImageView

use of javafx.scene.image.ImageView in project TeachingInSimulation by ScOrPiOzzy.

the class TestReslution2 method start.

@Override
public void start(Stage stage) throws Exception {
    final Pane pane = new StackPane();
    Scene scene = new Scene(pane, 600, 300);
    stage.setScene(scene);
    Button b = new Button("Snap");
    final ImageView iv = new ImageView();
    iv.fitWidthProperty().bind(pane.widthProperty());
    iv.fitHeightProperty().bind(pane.heightProperty());
    pane.getChildren().add(iv);
    pane.getChildren().add(b);
    b.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            SwingUtilities.invokeLater(new Runnable() {

                @Override
                public void run() {
                    doSnap(iv);
                    display();
                }
            });
        }
    });
    stage.show();
}
Also used : Button(javafx.scene.control.Button) ActionEvent(javafx.event.ActionEvent) ImageView(javafx.scene.image.ImageView) Scene(javafx.scene.Scene) StackPane(javafx.scene.layout.StackPane) Pane(javafx.scene.layout.Pane) StackPane(javafx.scene.layout.StackPane)

Example 8 with ImageView

use of javafx.scene.image.ImageView in project OTP2_R6_svaap by JNuutinen.

the class GameBackground method update.

@Override
public void update(double deltaTime) {
    if (deltaTime < 100) {
        // fiksaa oudon bugin tason alussa
        centerImage.setX(centerImage.getX() - (scrollSpeed * deltaTime));
        nextHorizontalImage.setX(nextHorizontalImage.getX() - (scrollSpeed * deltaTime));
    }
    if (centerImage.getImage().getWidth() + centerImage.getX() <= 0) {
        ImageView iv = centerImage;
        centerImage = nextHorizontalImage;
        nextHorizontalImage = iv;
        nextHorizontalImage.setX(centerImage.getX() + centerImage.getImage().getWidth());
    }
}
Also used : ImageView(javafx.scene.image.ImageView)

Example 9 with ImageView

use of javafx.scene.image.ImageView in project jgnash by ccavanaugh.

the class JasperViewerDialogController method refresh.

private void refresh() {
    final List<Node> children = pagePane.getChildren();
    children.clear();
    for (int i = 0; i < pageCount.get(); i++) {
        try {
            final BufferedImage bufferedImage = (BufferedImage) JasperPrintManager.printPageToImage(jasperPrint.get(), i, (float) zoom);
            final ImageView imageView = new ImageView(SwingFXUtils.toFXImage(bufferedImage, null));
            imageView.setEffect(dropShadow);
            children.add(imageView);
        } catch (final JRException ex) {
            StaticUIMethods.displayException(ex);
        }
    }
    setPageIndex(0);
}
Also used : JRException(net.sf.jasperreports.engine.JRException) Node(javafx.scene.Node) ImageView(javafx.scene.image.ImageView) JasperPrint(net.sf.jasperreports.engine.JasperPrint) BufferedImage(java.awt.image.BufferedImage)

Example 10 with ImageView

use of javafx.scene.image.ImageView in project Gargoyle by callakrsos.

the class DockTabPaneSkin method clone.

/**
	 * VERY HACKY - this lets us 'duplicate' Label and ImageView nodes to be used in a
	 * Tab and the tabs menu at the same time.
	 */
private static Node clone(Node n) {
    if (n == null) {
        return null;
    }
    if (n instanceof ImageView) {
        ImageView iv = (ImageView) n;
        ImageView imageview = new ImageView();
        imageview.setImage(iv.getImage());
        return imageview;
    }
    if (n instanceof Label) {
        Label l = (Label) n;
        Label label = new Label(l.getText(), l.getGraphic());
        return label;
    }
    return null;
}
Also used : Label(javafx.scene.control.Label) ImageView(javafx.scene.image.ImageView)

Aggregations

ImageView (javafx.scene.image.ImageView)201 Image (javafx.scene.image.Image)90 Button (javafx.scene.control.Button)45 Label (javafx.scene.control.Label)41 Insets (javafx.geometry.Insets)35 Tooltip (javafx.scene.control.Tooltip)32 VBox (javafx.scene.layout.VBox)29 Scene (javafx.scene.Scene)25 File (java.io.File)24 ChangeListener (javafx.beans.value.ChangeListener)24 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)20 Node (javafx.scene.Node)20 AnchorPane (javafx.scene.layout.AnchorPane)20 Callback (javafx.util.Callback)20 Pane (javafx.scene.layout.Pane)18 GridPane (javafx.scene.layout.GridPane)17 HBox (javafx.scene.layout.HBox)17 StackPane (javafx.scene.layout.StackPane)17 Inject (javax.inject.Inject)17 List (java.util.List)16