I understand that officially GWT recommends using the newer RootLayoutPanel but some posts on the internet claims that for some web applications it is better to use the RootPanel.
How can one decide which one to use?
Is there any different use cases for each? (or every requirement can be satisfied with either)
RootLayoutPanel
can't be better. It is just different.
RootPanel
allows you to add widgets to the page (basically you can use some html element on the page as root widget). You can define multiple RootPanel's
in the same application.
RootLayoutPanel
behaves a little bit differently, it always tries to fill all the available size in the window, so the content inside of the panel will perfectly fit the browser window size. It will also track the size of the window, and will resize child elements accordingly (if they support it). Also RootLayoutPanel
will try to attach itself directly to the <body> element
, e.g. you can't choose which html element on the page will become a "starting point".
So, depending on what you want to do you can choose RootPanel
or RootLayoutPanel
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With