List of usage examples for javafx.scene.image Image Image
private Image(Object externalImage)
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); String imageSource = "http://yourImageURL"; ImageView imageView = ImageViewBuilder.create().image(new Image(imageSource)).build(); Group myGroup = GroupBuilder.create().children(imageView).build(); root.getChildren().add(myGroup);/*from w ww . j av a 2 s . c o m*/ primaryStage.setScene(new Scene(root, 500, 400)); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { stage.setTitle("HTML"); stage.setWidth(500);/*from w ww. ja v a2 s .com*/ stage.setHeight(500); Scene scene = new Scene(new Group()); VBox root = new VBox(); final ImageView selectedImage = new ImageView(); Image image1 = new Image(Main.class.getResourceAsStream("a.jpg")); selectedImage.setImage(image1); selectedImage.setRotate(90); root.getChildren().addAll(selectedImage); scene.setRoot(root); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { stage.setTitle("HTML"); stage.setWidth(500);//from w w w . j a v a2 s . c o m stage.setHeight(500); Scene scene = new Scene(new Group()); VBox root = new VBox(); final ImageView selectedImage = new ImageView(); Image image1 = new Image(Main.class.getResourceAsStream("a.jpg")); selectedImage.setImage(image1); Rectangle2D viewportRect = new Rectangle2D(40, 35, 110, 110); selectedImage.setViewport(viewportRect); root.getChildren().addAll(selectedImage); scene.setRoot(root); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Label Sample"); stage.setWidth(400);/*from ww w . j a v a2s . c o m*/ stage.setHeight(180); HBox hbox = new HBox(); Image image = new Image(getClass().getResourceAsStream("labels.jpg")); Label label1 = new Label("Search", new ImageView(image)); hbox.setSpacing(10); hbox.getChildren().add((label1)); ((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("Label Sample"); stage.setWidth(400);//from ww w . j a v a2s . c o m stage.setHeight(180); HBox hbox = new HBox(); Image image = new Image(getClass().getResourceAsStream("labels.jpg")); Label label1 = new Label("Search"); label1.setGraphic(new ImageView(image)); hbox.setSpacing(10); hbox.getChildren().add((label1)); ((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("Label Sample"); stage.setWidth(400);/*w w w. ja va 2s .c om*/ stage.setHeight(180); HBox hbox = new HBox(); Image image = new Image(getClass().getResourceAsStream("labels.jpg")); Label label1 = new Label("Search", new ImageView(image)); hbox.setSpacing(10); hbox.getChildren().add((label1)); ((Group) scene.getRoot()).getChildren().add(hbox); label1.setLabelFor(hbox); System.out.println(label1.labelForProperty()); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Label Sample"); stage.setWidth(400);// w ww.ja va2s.c o m stage.setHeight(180); HBox hbox = new HBox(); Image image = new Image(getClass().getResourceAsStream("labels.jpg")); Label label1 = new Label("Search", new ImageView(image)); hbox.setSpacing(10); hbox.getChildren().add((label1)); ((Group) scene.getRoot()).getChildren().add(hbox); label1.setLabelFor(hbox); System.out.println(label1.getLabelFor()); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Label Sample"); stage.setWidth(400);/*from www. j a v a 2s . c o m*/ stage.setHeight(180); HBox hbox = new HBox(); Image image = new Image(getClass().getResourceAsStream("labels.jpg")); Label label1 = new Label("Search", new ImageView(image)); hbox.setSpacing(10); hbox.getChildren().add((label1)); ((Group) scene.getRoot()).getChildren().add(hbox); label1.setLabelFor(hbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { String imagePath = "resources/picture/yourImage.jpg"; Image image = new Image(imagePath); ImageView imageView = new ImageView(image); Button saveBtn = new Button("Save Image"); VBox root = new VBox(10, imageView, saveBtn); Scene scene = new Scene(root); stage.setScene(scene);/*from ww w . j av a 2 s.c o m*/ stage.setTitle(""); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { String imagePath = "resources/picture/yourImage.jpg"; Image image = new Image(imagePath); ImageView imageView = new ImageView(image); Button saveBtn = new Button("Save Image"); saveBtn.setOnAction(e -> saveToFile(image)); VBox root = new VBox(10, imageView, saveBtn); Scene scene = new Scene(root); stage.setScene(scene);//from w ww . jav a2s.c om stage.setTitle(""); stage.show(); }