Slick Forums

Discuss the Slick 2D Library
It is currently Sun May 19, 2013 5:45 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Using ComboBox [SLICK]
PostPosted: Mon Nov 07, 2011 3:09 am 
Offline

Joined: Wed Nov 02, 2011 7:32 am
Posts: 5
Is there a good example somewhere on how to use a ComboBox with Slick, or just in general?

I really do not understand whats going on in the widget to be able to figure it out myself.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 07, 2011 10:59 pm 
Offline

Joined: Wed Nov 02, 2011 7:32 am
Posts: 5
Come on guys! There's got to be a simpler answer then I'm thinking.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 08, 2011 4:55 am 
Offline

Joined: Sat Aug 13, 2011 8:04 pm
Posts: 70
Location: Canada
Here's an example I took from my code... I think I basically took it from the TWL examples:

Code:
// create a combo of the type that it holds passing a list model to the constructor
ComboBox<MyClass> aCombo = new ComboBox<MyClass>(myListModel);
// add a callback for when something is selected
aCombo.addCallback(new Runnable() {
   @Override
   public void run() {
      // find which one was selected
      System.out.println("Got "+aCombo.getSelected());
   }         
});
// set twl theme
aCombo.setTheme(myCombo");
// have it size itself from the data in it   
aCombo.setComputeWidthFromModel(true);
// start off with the first value selected
aCombo.setSelected(0);         


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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