我有一个父面板,它有 2 个子面板。一种是动态创建的内容,另一种是固定的高度和宽度。父面板使用边框布局,定义了中心和东部区域。当中心区域面板上出现溢出时,我试图让自动滚动在父面板上触发。我已将父面板的自动滚动选项设置为 true,但每次中心面板溢出时,它都会被切断。当我向中心区域面板添加溢出时,我会单独获得该面板的滚动条。我不需要它,但我希望它出现在整个父面板上。让我知道是否有人有任何建议..
2 回答
此问题通常是由于过度嵌套面板和/或布局中的一个或多个面板未layout
指定配置造成的。一些布局配置代码会有所帮助。
Here is my view from what I understood.. You have two panels that go into the center region of the border layout.. and you need a scroll bar for the center when one of the panels overflow.
Here is how I worked out a similar situation. In my center region, I have a panel with autoScroll set to true. I have two panels added to this panel. The first is fixed height (its a grid) and second is panel (displayed below the grid) is a large form panel. Due to the parent panel having a autoScroll property set, you will have a scroll bar for the entire panel and not the second panel alone!
I don't think you can use fit layout. In fit layout, the panel will take up the whole area of its container and you will not be able to add another panel (the second panel will be hidden I suppose!).
Note: I am using the default layout (Container Layout) I do not specify any layout in my parent panel.