I’m trying to use a scroll panel within niftygui to display messages. However; the text in this context is ending up with a strange black surround like this (only when scroll panel is created in Java):
How do I get rid of that?
I also can’t see anywhere in the java api to turn off the horizontal scroll bar, is that possible?
Minimal example:
Example.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<nifty xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://nifty-gui.lessvoid.com/nifty-gui" xsi:schemaLocation="https://raw.githubusercontent.com/void256/nifty-gui/1.4/nifty-core/src/main/resources/nifty.xsd https://raw.githubusercontent.com/void256/nifty-gui/1.4/nifty-core/src/main/resources/nifty.xsd">
<useControls filename="nifty-default-controls.xml"/>
<useStyles filename="nifty-default-styles.xml"/>
<screen id="letterSelect" controller="test.NiftyController">
<layer id="foreground" childLayout="center">
<panel id="scrollHolder" height="80%" width="85%" align="center" childLayout="vertical">
</panel>
</layer>
</screen>
</nifty>
Main:
public class Main extends SimpleApplication {
@Override
public void simpleInitApp() {
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(
assetManager, inputManager, audioRenderer, guiViewPort);
Nifty nifty = niftyDisplay.getNifty();
guiViewPort.addProcessor(niftyDisplay);
nifty.addXml("Interface/example.xml");
nifty.gotoScreen("letterSelect");
}
@Override public void simpleUpdate(float tpf) {}
public static void main(String[] args){
Main main = new Main();
main.start();
}
}
Nifty controller (dynamically creates a scroll pane, with some text in it):
public class NiftyController implements ScreenController {
private Nifty nifty;
private Screen screen;
public void bind(Nifty nifty, Screen screen) {
this.nifty = nifty;
this.screen = screen;
}
@Override
public void onStartScreen() {
Element scrollHolderPanel = screen.findElementById("scrollHolder");
scrollHolderPanel.getChildren().forEach(Element::markForRemoval);
new PanelBuilder() {{
childLayoutCenter();
height("100%");
width("100%");
control(new ScrollPanelBuilder("scroll") {{
panel(new PanelBuilder() {{
valignTop();
childLayoutCenter();
height("400px");
panel(new PanelBuilder() {{
childLayoutVertical();
height( "100px");
panel(new PanelBuilder() {{
childLayoutVertical();
text(new TextBuilder() {{
textVAlignTop();
textHAlignLeft();
text("some example text");
font("Interface/Fonts/Default.fnt");
//color("#000000");
height("100%");
width("100%");
}});
}});
}});
}});
}});
}}.build(nifty, screen, scrollHolderPanel);
}
@Override public void onEndScreen() {}
}