GwtPanel Vertical Panel Height

I have a horizontal panel with three vertical panels inside. Vertical panels have custom widgets

I need all vertical panels to have the same height (even if they have a different number of widgets inside) and a button in empty space.

So, I put all panels height = 100%, and buttons height = 100%.

The problem is that the height of the cells of the vertical panel is greater than that of my widgets, so it left a space between all the widgets of the vertical panels.

Here is an example

How to adjust cell height of vertical panels to my widget height. My widgets are not images, as in the example, so I cannot know the height of the widgets.

I have a lot of time in this problem, anyidea will help thanks !!!!

+3
source share
1 answer

I haven’t tried, but this should work, or at least give you something to start with:

VerticalPanel.setCellHeight(yourWidget, Integer.toString(yourWidget.getElement().getOffsetHeight())+"px");

What it does: setCellHeight () sets the height of the cell at which the widget goes to the function.
The second parameter in the function is the height of this cell. This is a little complicated because you do not know the height. Using getElement () you get an element of this widget in the browser DOM, on this element you can call getOffsetHeight ().
getOffsetHeight () returns an integer, so you need to pass it to String and concatenate "px" so that the browser knows its pixel, not em or something like that.

0
source

Source: https://habr.com/ru/post/1754972/


All Articles