Need help with ScrollPane sizing inside nested panes
kevin.s at qualitycode.com
Thu Sep 11 15:57:58 UTC 2014
That seems to have done the trick. It's like magic!
On 09/11/2014 05:12 AM, Eric Le Ponner wrote:
> Try using StackPane in place of Pane.
> Pane is pretty basic in term of layout capabilities.
> On 11 Sep 2014, at 01:46, Kevin Smith <kevin.s at qualitycode.com> wrote:
>> If we have a Pane containing a ScrollPane containing a GridPane,
>> everything works as expected. But as soon as we inject a second Pane
>> (which is hard for us to avoid in this case), the ScrollPane no longer
>> grows to fit its space. See the example app below. Without "inner", it
>> works great.
>> Is there a simple way to get the ScrollPane to fill its parent?
>> I have tried every combination of prefWidth and prefViewportWidth that I
>> can think of, and I have tried Border Pane, and nothing has worked. I
>> have searched the web, but have been unable to find an answer to this.
>> If the answer is already out there, please feel free to just point me to
>> I just upgraded to Java 8u20, which didn't help.
>> public class FxScrollPaneTest extends Application
>> public static void main(String args)
>> public void start(Stage primaryStage)
>> primaryStage.setTitle("Hello World!");
>> GridPane grid = new GridPane();
>> grid.add(new Label("upper left"), 0, 0);
>> grid.add(new Label("upper right"), 1, 0);
>> grid.add(new Label("lower left"), 0, 1);
>> grid.add(new Label("lower left"), 1, 1);
>> Pane root = new Pane();
>> Pane inner = new Pane();
>> ScrollPane scroller = new ScrollPane(grid);
>> primaryStage.setScene(new Scene(root, 300, 250));
More information about the openjfx-dev