This discussion is archived
2 Replies Latest reply: Feb 12, 2013 2:47 PM by U.S. RSS

JavaFX SplitPane resize weight distribution?

U.S. Newbie
Currently Being Moderated
How can I control the width/height distribution on a JavaFX SplitPane when a resize operation occurs? I would like one of the components to be unaffected by a resize, leaving the divider where it is, rather than distributing the resize weight evenly between both components. SplitPane seems to have no way to control the resize weight the way Swing's JSplitPane does. Is there way to do this (using FXML, preferrably)?
  • 1. Re: JavaFX SplitPane resize weight distribution?
    alabala_kiril Newbie
    Currently Being Moderated
    I haven't tried it, but what happens if you call setMaxWidth(...) on one of the panes inside the SplitPane?
  • 2. Re: JavaFX SplitPane resize weight distribution?
    U.S. Newbie
    Currently Being Moderated
    setMaxWidth would prevent that element to be sized larger than that, but in a similar thread, user 963038 mentioned the solution that does the trick (user can continue to resize, but the comonent is not auto-resized when the parent is resized):

    SplitPane.setResizableWithParent( componentNotToResize, false );

    Notice that unlike JSplitPane, JavaFX SplitPane can handle more than two components with N-1 splits. Calling the static setResizableWithParent with the component that should not be auto-resized works at least in my case, and I expect it to work just fine so long as not all components in the SplitPane are "frozen" like this.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points