Sorry if is a stupid question, but i am new to JavaFX.
I stored an ImageView that i created in SceneBuilder in an Arraylist, but when i try to change the LayoutX (or even when i try to use other ImageView methods) it doesn’t nothing.
the code is this:
@FXML ImageView myImageView = new ImageView();
ArrayList<ImageView> myList = new ArrayList<ImageView>();
public Controller()
{
myList.add(myImageView);
}
i try to change LayoutX with this simple fuction that i associated with pressing a key, but does nothing:
public void move()
{
myList.get(0).setLayoutX(myList.get(0).getLayoutX() - 50);
}
if i just do like this it works, but i want to use the ArrayList:
public void move()
{
myImageView.setLayoutX(myImageView.getLayoutX() - 50);
}
andrea ferretti is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.