Scroll panels - CottonMC/LibGui GitHub Wiki
Scroll panels (WScrollPanel) provide scroll bars for another widget inside them. For example, you might have a tall WPanel that needs to be scrolled.
WPanel myTallPanel = <...>;
WScrollPanel scrollPanel = new WScrollPanel(myTallPanel);
root.add(scrollPanel, 0, 1);You can also control which scroll bars appear. By default, both scroll bars are in automatic mode (TriState.DEFAULT), which means that they will appear if needed. You can change this behavior with setScrollingHorizontally and setScrollingVertically.
Both methods take a
TriStatefrom Fabric API whereTRUEis "always show",FALSEis "never show" andDEFAULTis the automatic mode.
We can use the methods to make our tall panel always scroll vertically but never horizontally:
scrollPanel.setScrollingHorizontally(TriState.FALSE);
scrollPanel.setScrollingVertically(TriState.TRUE);