bio photo

The ListBox has been greatly improved and got itself a new Nifty Java API. You can find an example right here (click the image for a webstart demo) or keep reading for all the details below.

Example</strong></p>

You can check the first example of the new ListBox online with the following Webstart URL:

<img title="Bildschirmfoto 2010-12-12 um 23.40.53" src="../wp-content/2010/12/Bildschirmfoto-2010-12-12-um-23.40.53-300x225.png" alt="" width="300" height="225" /></a></p>

The source code of this project is available online. You can check out the source directly from SVN using https://nifty-gui.svn.sourceforge.net/svnroot/nifty-gui/nifty-default-controls-examples/trunk</a> or you can browse it online here: http://nifty-gui.svn.sourceforge.net/viewvc/nifty-gui/nifty-default-controls-examples/trunk/</a>.</p>

And if that is not enough ... we've done the same new API treatment to the CheckBox and we plan to do the same to the remaining Nifty Standard Controls!

Reference in the Wiki</strong></p>

You can find a complete reference about the new standard controls in Nifty 1.3 already on the Wiki (for the ListBox and the CheckBox):

http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Nifty_Standard_Controls_%28Nifty_1.3%29</a></p>

And you can keep reading about all the little Nifty details we've changed and improved and especially why.

It all started with a feature request for Nifty 1.3</a> which seems easy to add at first. Removing all or single elements from a Nifty ListBox sounds like a reasonable feature to have available. So I'd try to add this ... and failed miserable! :) The closer I looked into it the more despaired I've become.</p>

What a mess!

Something I'd really love to do with Nifty 2.0 is to add a nice and clean API to the standard Nifty controls. The current way of interacting with most of the Nifty controls is kinda awkward (at least) and I want to improve this. So, I thought, hey, why not try to define a new API for the ListBox as a preparation for this and see how everything works out. Well, it turns out that in the end I've pretty much rewrote the whole ListBox! =) And that the new one is way better than what you currently have available!

One of the shortcomings of the old ListBox was speed. Internally it directly added the Nifty element tree adding elements dynamically and then used a Scrollpanel to scroll around that (maybe) huge list of elements. So basically it always rendered all elements and used the clipping of the element to hide everything that was not currently seen. Not a great idea after all :)

Another problem was the API and that's a little difficult to interact with Niftys internal screen representation. Although it's not impossible to dynamically add/remove elements from Nifty this might not be the ideal solution to the ListBox problem.

So what did we changed? Well, actually a lot! :)

The new ListBox:</strong></p>