I have a vertical panel in gwt and I want to add widgets into it from bottom to top.
In some reasons I want this.
Is that possible?
Actually I want to show results vice versa.
You can use
insert(Widget w, int beforeIndex)
Here, for bottom to top, you need to set beforeIndex to 0
Refer to GWT Vertical Panel
I think a best approach is to create your own VerticalPanel by creating a class that extends Composite, and implementing desired behavior.addToButtom() , addtoTop() ...
Related
I'm trying to add a scrollbar to a text area component. I could use FlowPanel, but I need to use GridBagPanel for my other components and when I tried to add a flowpanel inside the gridbagpanel it was empty and like 2x2 pixels.
Is there a way to add two panels to a MainFrame or add the scrollbar some other way?
I'm a newbie to GWT.And i wonder when to use panels and when to use layout panels.I'm really confused.Can anyone provide a legit use case , where we need to use panels instead of layout panels and vice versa?.Thanks.
When you need a child to take its initial size from a parent and then resize when a parent resizes, use a LayoutPanel or another panel that implements ProvidesResize() interface. This way, for example, you can split the browser window into top menu and main area parts, and make the main area change its size as the browser windows is resized.
When you want a panel to take its size from its own content, use HTMLPanel or FlowPanel.
I have a HorizontalPanel and I added two Buttons to it.
The HorizontalPanel is already as wide as its parent.
I want each Button to take a half of the HorizontalPanel. How can I do it programmatically?
Or maybe am I using the wrong panel? Any advice would be appreciated.
I tried setWidth("50%"). It looks strange. I also tried other panels e.g. FlowPanel. I just cannot figure it out...
Use setWidth("100%") instead of setWidth("50%") for both the Buttons and then add it to HorizontalPanel.
I'm trying to build a GWT GUI, but I'm not sure if it's possible. Basically, I need to be able to stack three layouts/panels, one on top of another like this:
Bottom Layout: Panel that fills the whole screen (will actually contain SVG stuff).
Middle Layout: DockLayoutPanel with tools docked around the edges, also full screen.
Top Layout: Transparent panel, again filling the whole screen.
Is it possible to stack panels like this? I assume I could use AbsolutePanel to do it somehow, but I was hoping for a nicer solution.
Thanks,
Jon
Because you want a DockLayoutPanel inside, try with a LayoutPanel (or the RootLayoutPanel) and simply add your widgets in order as, by default, a child of a LayoutPanel fills its parent.
I need a scrollPanel with a verticalpanel and a tablayout panel inside it. Problem is, unless I specify the exact height of the tablayoutPanel, the tab content does not show. Any known fixes/ workarounds?
Not the answer you are looking for, but might spark an idea for another way to do this - what does it mean to scroll a tab panel? As soon as the user starts scrolling down, the tabs will no longer be visible to change tabs, user will always need to scroll all the way to the top to consider any other tab.
That said, any of the *LayoutPanel classes GWT has introduced that implement ProvidesResize, RequiresResize, etc need sizing to properly draw themselves and their content. This is why you are having the issue. These classes are designed to size their children, not to just consume as much space as those children require.
Closest I can suggest to a workaround (except for putting a ScrollPanel inside the TabLayoutPanel instead) would be to know the height of the current tab's contents, add to that the height of just the tabs themselves, and assign that as the height of the tabpanel. Not a very nice solution, but it might get you by.