var mainRow = 0;
var title = utils.addTitle(mainWindow, "", mainRow++, 0);
title.setBackground(backgroundImage);
var credits = new Container();
var listBox = mainWindow.addChild(new ListBox<String>(), mainRow++, 0);
listBox.setVisibleItems(15);
var nextItem = 0;
for( int i = 0; i < 30; i++ ) {
listBox.getModel().add("Dummy list entry " + nextItem);
nextItem++;
}
utils.addLabel(mainWindow, "", mainRow++, 0);
utils.addButton(mainWindow, "Back", this, "back", mainRow, 0);
utils.centerMainPanel(mainWindow);
This makes me a list of 15 visible entries, including a slider (which I don’t really need, but that is ok for now). I have only keyboard or game controller to navigate.
My issue is that with the up/down arrows I can select the up scroll and down scroll arrow, but to go down to the “Back” button, I have to hit 15 times (the list items it looks like) until I’m on the active Back button.
What I want in the end is a slow autoscroll as soon I have the credits screen open and an active “Back” button. Or a the very least only the scroll part and the button should be navigated but not the list entries.
…unfortunately, I think this was not entirely wired up because reading the code I think that the GuiControl will be caught first if you try to add your own FocusTraversal implementation.
But it’s somewhere in and around that capability.
I do wonder if a list box is really what you want here since you don’t want to be able to navigate the children and you don’t want the scroll bar. Why use a list box at all?
True, I figured a solution and did my own ScrollContainer with a method scroll which does scroll one line up when calling scroll() It does it endlessly (starts over if the end is met).
It is a line by line scrolling, but a smooth scrolling would be cooler, have to think of a solution. Not a pressing issue tho, but wouldn’t mind some ideas
Sounds like a good solution. Have to get my head around jme view ports first I guess, never did anything consciously with them. Even an endless scroll is easily done that way just reset it after last line is out.