Re: Jlist items not appearing occasionally
- From: IchBin <weconsul@xxxxxxx>
- Date: Thu, 19 Jan 2006 18:19:14 -0500
Allan Bruce wrote:
"IchBin" <weconsul@xxxxxxx> wrote in message news:VvacnW_PlKY18FPeUSdV9g@xxxxxxxxxxI am do ton's of JTable updates across multiple tables with no problem. Are you loading your GUI as below..Allan Bruce wrote:I am adding entries to a JList via a DefaultListModel from a single thread but sometimes the entries do not show unless I modify the list. To give some context, I have an instant messenger application and on login, several users are added to the list. Sometimes the list appears fine in that all users are shown and selectable etc. however sometimes nothing shows on the list - if this is the case, when another user logs in (thus adding agin to the list) the list shows correctly with all users. I have code below to show how I am initialising the list and adding to it. Should I be doing anything more? Is there a way to force the contents of the list to refresh?
Thanks Allan
// creation of list mList = new DefaultListModel(); mListBox = new JList(mList); mStatusBar = new JStatusBar(3); getContentPane().setLayout(new BorderLayout()); getContentPane().add(new JScrollPane(mListBox)); getContentPane().add(mStatusBar, BorderLayout.SOUTH);
// adding to list
mList.addElement(xiUser.userName()); // just a plane old String being addedCode looks fine. Don't think this could be the problem but you cold try
mList.add(mListBox.getModel().getSize(), xiUser.userName());
I would be concerned with the xiUser.userName() call.
This must be the problem.
Easy way to find out is to step trace it in a debugger.
The Strings are definately defined and have length >0 however I think it might be a swing/threads problem...
Allan
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
SomeCcreateAndShowGUIMethod();
}
});
--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"' -William E. Taylor, Regular Guy (1952-) .
- Follow-Ups:
- Re: Jlist items not appearing occasionally
- From: Allan Bruce
- Re: Jlist items not appearing occasionally
- References:
- Jlist items not appearing occasionally
- From: Allan Bruce
- Re: Jlist items not appearing occasionally
- From: IchBin
- Re: Jlist items not appearing occasionally
- From: Allan Bruce
- Jlist items not appearing occasionally
- Prev by Date: Re: Need help with decoding URL
- Next by Date: Re: Jlist items not appearing occasionally
- Previous by thread: Re: Jlist items not appearing occasionally
- Next by thread: Re: Jlist items not appearing occasionally
- Index(es):
Relevant Pages
|