What is says in the topic title.
I’m trying to implement a ScrollPanel that has the following attributes:
- Vertical scrolling only. So, I want to remove the horizontal scroll bar to maximize screen real estate.
- A narrower vertical scroll bar.
- Every part of the ScrollPanel is transparent except the vertical slider bar and the child Elements placed on the panel. The Elements should seem to hang in space.
[java]
float dockBHeight = 30;
float width = screen.getWidth();
float height = screen.getHeight();
ScrollPanel dockP = new ScrollPanel(screen, “dockPanel”, new Vector2f(width0.8f, height0.10f), new Vector2f(width0.20f, height0.85f));
dockP.setIsMovable(false);
dockP.setIsResizable(false);
dockP.getVerticalScrollBar().setDimensions(10, dockP.getHeight());
for (int i = 0; i < 30; i++) {
ButtonAdapter tempB = new ButtonAdapter(screen) {};
tempB.setText(String.valueOf(i));
tempB.setWidth(dockP.getWidth()-dockP.getVerticalScrollBar().getWidth());
tempB.setHeight(dockBHeight);
tempB.setPosition(0, i*dockBHeight);
dockP.addScrollableContent(tempB);
}
screen.addElement(dockP);
[/java]
The VerticalScrollBar will not shrink to 10 pixels wide, and its height does not extend to the height of the ScrollPanel–the panel ends up being longer than the VerticalScrollBar. To make the panel background invisible, I’ve tried using dockP.setIsVisible(false) and dockP.getScrollableArea().setIsVisible(false), but those hide all child Elements as well–the latter at least keeps the VerticalScrollBar visible though.
Here’s what it currently looks like with 5 buttons (right side of screen, numbered buttons descending vertically). The ScrollPanel under the buttons is still visible, though it seems like the VerticalScrollBar should be 10 pixels wide (see how far the buttons extend toward the screen edge).
And with 30 buttons, we see that the VerticalScrollBar appears wider than 10 pixels and does not extend the whole height of the panel:
Any help is appreciated!