Slick Forums

Discuss the Slick 2D Library
It is currently Wed Jun 19, 2013 5:38 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Jan 18, 2012 7:37 am 
Offline

Joined: Fri Jan 06, 2012 2:15 am
Posts: 44
Is it possible to have a ListBox contain something other than a String? I'm hoping for something similar to what Adobe Flex allows where you "plug in" a generic component (Widget in TWL's case). Basically you provide a custom item renderer to draw each item in the list, etc. Examples don't appear to do anything like this so I'm guessing it's not a current feature? (Would it be hard to implement if not?)


Top
 Profile  
 
PostPosted: Wed Jan 18, 2012 10:19 am 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1188
I suggest to switch to Table which is more flexible with custom cell renderer etc - but it's also possible with ListBox by subclassing it can overriding createDisplay().

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Thu Jan 19, 2012 12:05 am 
Offline

Joined: Fri Jan 06, 2012 2:15 am
Posts: 44
Oh okay, I'll take a look at Table.


Top
 Profile  
 
PostPosted: Fri Jan 20, 2012 11:39 pm 
Offline

Joined: Fri Jan 06, 2012 2:15 am
Posts: 44
Table seems somewhat complicated to use (TableDemoDialog1.java), is there a better example or developers guide somewhere that I've neglected to review? Not having much luck figuring out what's needed for such functionality, what the difference between a WidgetCreator/Renderer is, the purpose of a model, etc.


Top
 Profile  
 
PostPosted: Sat Jan 21, 2012 12:13 am 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1188
The TableModel contains the data displayed in the Table widget, similar to the ListModel. Use AbstractTableModel as base if you want to create your own.

The CellWidgetRenderer uses a stamping approach for rendering custom data - see DecoratedTextRenderer from the TWL Theme Editor as example.

A CellWidgetCreator adds the ability to the CellWidgetRenderer to create a widget per table cell (like a combo box, edit field etc). This is also used by the Theme Editor in the GradientStopEditorFactory class (as a inner class).

The CellWidget* instances are registered by the data type of the cell. See the 2nd link for details.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group