Skip to content

Instantly share code, notes, and snippets.

Created March 17, 2018 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d79491d792a672458f7d9c8bea6b52f4 to your computer and use it in GitHub Desktop.
Save anonymous/d79491d792a672458f7d9c8bea6b52f4 to your computer and use it in GitHub Desktop.
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.geometry.Rectangle2D;
public class PP4o11TEST extends Application {
public void start(Stage primaryStage)
{
final Image img= new Image(PP4o11TEST.class.getResourceAsStream("gull.jpg"));
ImageView imgView = new ImageView(img);
ImageView imgView2= new ImageView(img);
imgView.setViewport(new Rectangle2D(200,80,70,60));
imgView2.setViewport(new Rectangle2D(400,100,30,90));
StackPane pane= new StackPane(imgView);
Scene scene= new Scene(pane, 500, 350);
pane.setStyle("-fx-background-color:cornsilk");
StackPane pane2= new StackPane(imgView2);
Scene scene2= new Scene(pane,700, 150);
pane.setStyle("-fx-background-color:cornsilk");
primaryStage.setTitle("Viewport Gull");
primaryStage.setScene(scene);
primaryStage.show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment