Skip to content

Instantly share code, notes, and snippets.

Created March 17, 2018 17:27
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/eec97cbe34dd1635eda72e59487a5a5f to your computer and use it in GitHub Desktop.
Save anonymous/eec97cbe34dd1635eda72e59487a5a5f 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)
{
Image img= new Image("gull.jpg");
ImageView imgView = new ImageView(getClass().getResource("gull.jpg").toExternalForm());
Image img2= new Image("gull.jpg");
ImageView imgView2 = new ImageView(getClass().getResource("gull.jpg").toExternalForm());;
imgView.setViewport(new Rectangle2D(200,80,70,60));
imgView2.setViewport(new Rectangle2D(400,100,30,90));
StackPane pane= new StackPane(imgView);
StackPane pane2= new StackPane(imgView2);
pane.setStyle("-fx-background-color:cornsilk");
Scene scene= new Scene(pane, 500, 350);
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