powered by Jive Software

Please help with JList and SMACK

Hello,

I am making an IM client using the smack library. It is a GUI client, and I have a question about JList. Assuming I have established a connection and all that using a valid id and password, how do I load the Roster (of my buddies) into JList so that when I double click on a contact, I can notify a listener to open a chat window gui (which I have made separately)? I’m mainly confused about JList, as I only know how to add string items to it that have no listeners attached to each of them.

Thanks.

Hello,

This is more of a general Java question rather than a smack one so there are probably better places to look for help, but having said that here are a couple of tips:

  1. Look at the JList javadocs, focusing on the parts about how to use ListModels and MouseListeners.

  2. Take a look at this thread about how to use a JTable show to a roster list. The thread is a bit old but the general implementation should still be helpful.

Hope that helps,

Ryan