Skip to content

Instantly share code, notes, and snippets.

Created March 18, 2018 16:03
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/76565799ee6d71716538618993449b8e to your computer and use it in GitHub Desktop.
Save anonymous/76565799ee6d71716538618993449b8e 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(pane2,700, 150);
pane2.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