JavaFX Viewport Issues

JavaFX Viewport Issues


Hi All,

I’m having problems with two objects from the same image that are supposed to be viewable side-by-side with viewport constraint. The first image object shows but not the second.

There are no syntax errors and it compiles but it is a logic issue. gull image can be substituted for any picture as long as its in same folder as the script.

P.S. the IDE above does not work for FX, it will have to be run in another IDE.


When I try to view the link you posted, I get a 404 error.


Thanks for bringing that to my attention, I just changed the link so it should be working now


Try this:

final Image img = new Image(PP4o11TEST.class.getResourceAsStream("gull.jpg"));
ImageView imgView = new ImageView(img);
ImageView imgView2 = new ImageView(img);


Its producing a cannot find symbol for Fresh


Sorry, replace Fresh with the name of your class, PP4o11TEST.

It also looks like you need to add another Scene for pane2.


Adding another scene for pane2 compiles but nothing will render now


From your code:

Scene scene2= new Scene(pane,700, 150);

Notice that on both lines you’re using pane again instead of pane2.


No difference