List of usage examples for javafx.scene.image ImageView ImageView
public ImageView(Image image)
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Toggle Button Sample"); stage.setWidth(250);// www . j a v a 2 s . c o m stage.setHeight(180); final ToggleGroup group = new ToggleGroup(); group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() { public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle) { System.out.println((Color) group.getSelectedToggle().getUserData()); } }); Node rootIcon = new ImageView(new Image(getClass().getResourceAsStream("root.png"))); ToggleButton tb1 = new ToggleButton("A", rootIcon); tb1.setSelected(true); tb1.setToggleGroup(group); tb1.setUserData(Color.LIGHTGREEN); tb1.setSelected(true); ToggleButton tb2 = new ToggleButton("B"); tb2.setToggleGroup(group); tb2.setUserData(Color.LIGHTBLUE); ToggleButton tb3 = new ToggleButton("C"); tb3.setToggleGroup(group); tb3.setUserData(Color.SALMON); HBox hbox = new HBox(); hbox.getChildren().add(tb1); hbox.getChildren().add(tb2); hbox.getChildren().add(tb3); ((Group) scene.getRoot()).getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Toggle Button Sample"); stage.setWidth(250);/*from w ww . j a v a2 s . c o m*/ stage.setHeight(180); final ToggleGroup group = new ToggleGroup(); group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() { public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle) { System.out.println((Color) group.getSelectedToggle().getUserData()); } }); Node rootIcon = new ImageView(new Image(getClass().getResourceAsStream("root.png"))); ToggleButton tb1 = new ToggleButton("A", rootIcon); System.out.println(tb1.toggleGroupProperty()); tb1.setToggleGroup(group); tb1.setUserData(Color.LIGHTGREEN); tb1.setSelected(true); ToggleButton tb2 = new ToggleButton("B"); tb2.setToggleGroup(group); tb2.setUserData(Color.LIGHTBLUE); ToggleButton tb3 = new ToggleButton("C"); tb3.setToggleGroup(group); tb3.setUserData(Color.SALMON); HBox hbox = new HBox(); hbox.getChildren().add(tb1); hbox.getChildren().add(tb2); hbox.getChildren().add(tb3); ((Group) scene.getRoot()).getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Toggle Button Sample"); stage.setWidth(250);//from www .j a va 2 s .c om stage.setHeight(180); final ToggleGroup group = new ToggleGroup(); group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() { public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle) { System.out.println((Color) group.getSelectedToggle().getUserData()); } }); Node rootIcon = new ImageView(new Image(getClass().getResourceAsStream("root.png"))); ToggleButton tb1 = new ToggleButton("A", rootIcon); System.out.println(tb1.selectedProperty()); tb1.setToggleGroup(group); tb1.setUserData(Color.LIGHTGREEN); tb1.setSelected(true); ToggleButton tb2 = new ToggleButton("B"); tb2.setToggleGroup(group); tb2.setUserData(Color.LIGHTBLUE); ToggleButton tb3 = new ToggleButton("C"); tb3.setToggleGroup(group); tb3.setUserData(Color.SALMON); HBox hbox = new HBox(); hbox.getChildren().add(tb1); hbox.getChildren().add(tb2); hbox.getChildren().add(tb3); ((Group) scene.getRoot()).getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Toggle Button Sample"); stage.setWidth(250);//from w w w .ja v a2 s.c om stage.setHeight(180); final ToggleGroup group = new ToggleGroup(); group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() { public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle) { System.out.println((Color) group.getSelectedToggle().getUserData()); } }); Node rootIcon = new ImageView(new Image(getClass().getResourceAsStream("root.png"))); ToggleButton tb1 = new ToggleButton("A", rootIcon); System.out.println(tb1.toggleGroupProperty()); tb1.setToggleGroup(group); tb1.setUserData(Color.LIGHTGREEN); tb1.setSelected(true); ToggleButton tb2 = new ToggleButton("B"); tb2.setToggleGroup(group); tb2.setUserData(Color.LIGHTBLUE); ToggleButton tb3 = new ToggleButton("C"); tb3.setToggleGroup(group); tb3.setUserData(Color.SALMON); System.out.println(tb3.getToggleGroup()); HBox hbox = new HBox(); hbox.getChildren().add(tb1); hbox.getChildren().add(tb2); hbox.getChildren().add(tb3); ((Group) scene.getRoot()).getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Toggle Button Sample"); stage.setWidth(250);/*from ww w . ja va2 s . c om*/ stage.setHeight(180); final ToggleGroup group = new ToggleGroup(); group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() { public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle) { System.out.println((Color) group.getSelectedToggle().getUserData()); } }); Node rootIcon = new ImageView(new Image(getClass().getResourceAsStream("root.png"))); ToggleButton tb1 = new ToggleButton("A", rootIcon); System.out.println(tb1.toggleGroupProperty()); tb1.setToggleGroup(group); tb1.setUserData(Color.LIGHTGREEN); tb1.setSelected(true); ToggleButton tb2 = new ToggleButton("B"); tb2.setToggleGroup(group); tb2.setUserData(Color.LIGHTBLUE); ToggleButton tb3 = new ToggleButton("C"); tb3.setToggleGroup(group); tb3.setUserData(Color.SALMON); tb3.fire(); HBox hbox = new HBox(); hbox.getChildren().add(tb1); hbox.getChildren().add(tb2); hbox.getChildren().add(tb3); ((Group) scene.getRoot()).getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:tachyon.view.Viewer.java
public Viewer(Resource scr, Project pro) { super(scr, pro); getCenter().setCenter(new ScrollPane(view = new ImageView(image = readFromFile(scr.getFile())))); controls = new ToolBar(); controls.setPadding(new Insets(5, 10, 5, 10)); getCenter().setTop(controls);/*from w w w. j av a 2 s .c o m*/ controls.getItems().addAll(zIn = new Button("Zoom In"), zOut = new Button("Zoom Out"), new Separator(), rotate = new Button("Rotate"), new Separator(), revert = new Button("Revert")); zIn.setOnAction((e) -> { if (zoom.get() < 2.0) { zoom.set(zoom.get() + 0.1); } }); zOut.setOnAction((e) -> { if (zoom.get() > 0.2) { zoom.set(zoom.get() - 0.1); } }); zoom.addListener((ob, older, newer) -> { view.setFitHeight(newer.doubleValue() * image.getHeight()); view.setFitWidth(newer.doubleValue() * image.getWidth()); }); rotate.setOnAction((e) -> { view.setRotate(view.getRotate() + 90); }); revert.setOnAction((e) -> { zoom.set(1.0); view.setRotate(0); }); }
From source file:net.thirdy.blackmarket.controls.Dialogs.java
public static void showExceptionDialog(Throwable throwable) { Alert alert = new Alert(AlertType.ERROR); alert.setTitle("Sorry something wrong happened"); String header = throwable.getMessage(); header = isBlank(header) ? throwable.getClass().getSimpleName() : header; alert.setHeaderText(header);/*from w w w . j a v a 2s .c o m*/ // alert.setGraphic(new ImageView(ImageCache.getInstance().get("/images/gallio/gallio-" // + comics[RandomUtils.nextInt(0, 3)] + // ".png"))); alert.setGraphic(new ImageView(ImageCache.getInstance().get("/images/gallio/gallio-sad.png"))); // Create expandable Exception. StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); throwable.printStackTrace(pw); String exceptionText = sw.toString(); StringBuilder sb = new StringBuilder(); // sb.append("Error Message: "); // sb.append(System.lineSeparator()); // sb.append(throwable.getMessage()); sb.append("The exception stacktrace was:"); sb.append(System.lineSeparator()); sb.append(exceptionText); TextArea textArea = new TextArea(sb.toString()); textArea.setEditable(false); textArea.setWrapText(false); textArea.setMaxWidth(Double.MAX_VALUE); textArea.setMaxHeight(150); // Set expandable Exception into the dialog pane. alert.getDialogPane().setExpandableContent(textArea); alert.getDialogPane().setExpanded(true); alert.showAndWait(); }
From source file:org.pdfsam.configuration.PdfsamConfig.java
@Bean public ImageView payoff() throws IOException { return new ImageView(new ClassPathResource("/images/payoff.png").getURL().toExternalForm()); }
From source file:vkmanager.controller.PhotosDetailedController.java
public void showPhotosFromAlbum(VKPhotoAlbum album, int userId) { this.album = album; idForDownload = album.getId();/*from w ww . j a v a 2 s.c o m*/ albumDescription.setText(album.getDescription()); photos = vkapi.getPhotosFromAlbum(idForDownload, userId); int i = 0; int j = 0; gridPaneDetailed.addRow(0); for (VKPhoto photo : photos) { Image photoThumbLink = new Image(photo.getLink_s()); ImageView photoThumb = new ImageView(photoThumbLink); photoThumb.setFitHeight(160); photoThumb.setFitWidth(240); photoThumb.setPreserveRatio(true); photoThumb.setSmooth(true); photoThumb.setCache(true); Button photoButt = new Button(); photoButt.setGraphic(photoThumb); photoButt.setStyle("-fx-background-color: white;"); photoButt.setMinSize(240, 160); photoButt.setAlignment(Pos.CENTER); BorderPane bp = new BorderPane(null, photoButt, null, null, null); gridPaneDetailed.add(bp, j, i); j++; if (j == 3) { i++; j = 0; gridPaneDetailed.addRow(i); } } }
From source file:org.pdfsam.ui.banner.BannerPane.java
@Inject public BannerPane(BannerButtons buttons, ImageView payoff, @Named("logo32") Image logo) { getStyleClass().add("pdfsam-banner"); current.getStyleClass().add("header-title"); HBox.setHgrow(buttons, Priority.ALWAYS); HBox logoView = new HBox(); logoView.getStyleClass().add("pdfsam-logo"); logoView.getChildren().addAll(new ImageView(logo), payoff); getChildren().addAll(logoView, current, buttons); eventStudio().addAnnotatedListeners(this); }