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!

How to set divider positions for SplitPane after window resizing ?

965853Sep 30 2014 — edited Oct 4 2014

Hi,

I would like to keep the same values of the positions for dividers (SplitPane) even if the width or the height of the window changes.

I wont to keep the proportion of the differents dividers.

After resizing the window, the values of positions are not the sames !

I use this source without success :

  stage.widthProperty().addListener(new ChangeListener<Number>() {

          @Override public void changed( ObservableValue<? extends Number> observableValue, Number number, Number number2) {

               sp.setDividerPositions(0.40f, 0.02f, 0.54f);

     }

  }); 

 

  stage.heightProperty().addListener(new ChangeListener<Number>() {

          @Override public void changed( ObservableValue<? extends Number> observableValue, Number number, Number number2) {

                sp.setDividerPositions(0.40f, 0.02f, 0.54f);

     }

  });

If you have a idea...

Thanks you in advance.

Fabrice

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 1 2014
Added on Sep 30 2014
7 comments
2,208 views