Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Setting ImageView to use space available without resorting to fixed values

john16384Dec 7 2011 — edited Jan 26 2012
I have the following structure:
BorderPane (which fills the Scene/Stage)
+-StackPane (center)
   +- BorderPane
       +- Group (center)
           +- ImageView
           +- ImageView
   +- other content
I use this code to create a backdrop for my "other content". It has two ImageViews so I can fade from one image to another, but the same problem occurs with just one ImageView.

My problem is, no matter what I do, if the Image associated with the ImageView is larger than my Stage, it will just adjust all the parents to be larger than allowed. The only thing I can do to prevent it is to hard code the size of the ImageView using the fitWidth/fitHeight properties, however, I donot know exactly how big these should be as it depends on the screen size and on things like borders (which may be css styled) of all the parents.

I put a BorderPane around my ImageView and put them in the center spot in the hope it will force them to take up all the available space... but not more.

I simply donot want the size of the ImageView to have ANY influence on the parent containing it.

Any ideas what I can try?

Edited by: john16384 on Dec 7, 2011 3:57 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 23 2012
Added on Dec 7 2011
6 comments
1,832 views