JavaFX Viewport Issues

JavaFX Viewport Issues
0

#1

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.


#2

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


#3

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


#4

Try this:

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

#5

Its producing a cannot find symbol for Fresh


#6

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

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


#7

Adding another scene for pane2 compiles but nothing will render now


#8

From your code:

Scene scene2= new Scene(pane,700, 150);
pane.setStyle("-fx-background-color:cornsilk");

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


#9

No difference