Nifty Gui Tabs

Hey folk,

I have a kind of problem with nifty gui.
I used xml to create a tabGroup.

Now I want to get the Controller in java. Currently I am using the getControl method of Element.
In order to use this method, I need the spezific class of the controler.
I looked up the nifty repo and found the class TabGroupControl. But this class is deprecated with the comment to use the TabGroup interface.
But it is not possible to use the Interface with the getControl method (because the interface doesn`t implement the abstract class Controller).

For sure I can use the deprecated class, but I am looking for another solution.
I also don`t want to implement the interface with my own controller.

ok my bad…just use the getNiftyControl methode :smiley:

1 Like

Now I have another problem with Tabs… :-[

I have created a gui element with a tabgroup.
I want to add/remove tabs in this tabgroup by using java code.

I found the methode add() and remove() in tabgroup Interface. If I mark an Object X in my game, the tabgroup need the tab called ‘Storage’. If I mark an Object Y, the tabgroup does not need the tab called ‘Storage’. In order to do that, I am using add() and remove().
But I get an IndexOutOfBoundException when I use the remove methode. The ‘Storage’ tab is definitly added when I call the remove() methode.

Does anyone has an idea to solve this?
Or does anyone has a better idea to add and remove tabs?

thx

Sorry, I don’t think many people here use the tab control.

(I rolled my own for herodex)

hi,

thx for answering. I think it is a bit weird that such a basic gui structur doesn’t work.
Do you know about any plans to fix this in nifty?

Do you implement the tab-related interfaces from Nifty or do you wrote everything by yourself?