Scroll panel is broken

I created a pop-up element with a scroll panel on it through the JavaBuilder. When I run the application, the Scroll Panel looks right in its dimensions and everything, but all of the inner panels I attached are rendering completely wrong. The text looks like the actual letters have 0 alpha and the outlying pixels are all whatever color I set the text to, the panels are tinted the color of their parent panel, and when I try to scroll up on any of the panels it doesn’t do anything.
So, I changed the style of the Scroll Panel to a random panel, and that fixed the rendering problems, but now the dimensions of the Scroll Panel are completely messed up. The panel I set the style to shows the correct size, but the scroll panel is showing half the size of the full panel. Here’s the code for the Popup:
[java]
PopupBuilder partSelectionBuilder = new PopupBuilder(“PartSelection”) {
{
backgroundColor("#00000066");
childLayoutHorizontal();
panel(new PanelBuilder(“SelectionPanel”) {
{
onStartScreenEffect(new EffectBuilder(“move”) {
{
name(“move”);
timeType(“exp”);
length(100);
effectParameter(“mode”, “in”);
effectParameter(“direction”, “left”);
inherit(true);
}
});
onEndScreenEffect(new EffectBuilder(“move”) {
{
name(“move”);
timeType(“exp”);
length(100);
effectParameter(“mode”, “out”);
effectParameter(“direction”, “left”);
inherit(true);
}
});
width(“40%”);
height(“100%”);
childLayoutVertical();
style(“nifty-panel-red-no-shadow”);
control(new ScrollPanelBuilder(“PartScrollPanel”) {
{
panel(new PanelBuilder(“ScrollPanelInnards”) {
{
childLayoutVertical();
width(“100%”);
height(defaultShipParts.size() * 25 + “%”);
}
});
height(“90%”);
width(“100%”);
style(“nifty-panel-no-shadow”); //This line changes between messed up dimensions and messed up rendering
}
});
control(new ButtonBuilder(“AddPartButton”) {
{
height(“10%”);
width(“50%”);
align(Align.Right);
label(“Add Part”);
interactOnClick(“addPart()”);
}
});
}
});
}
};
partSelectionBuilder.registerPopup(nifty);
[/java]

It’ll probably be worth mentioning that I’ve tried removing the panel with the id “ScrollPanelInnards” and using the absolute layout that is default with the Scroll Panel to lay out my elements, but the rendering problem persists then as well. I’m going to try rewriting the panel in XML to see if that fixes anything.

A picture of the panels without the style applied.

I think your difficulties may be related to issue #609, which I ran into back in October. Fortunately, there’s a workaround. Please refer to this thread: http://hub.jmonkeyengine.org/forum/topic/nifty-labels-inside-a-scrollpanel-control/

1 Like

@sgold That fixed the problem, thanks!

2 Likes