File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help me reducing JTABLE loading time..

 
shailesh jamloki
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi my small application loads connected agents with properties in a jtable.
*Connected agents are are some process which are listening to some port.

If I have 30 agents and out of 20 are connected. So I have to load 20 agents in the table.

But when the application loads.. my swing application hangs as it takes time to see if all the agents are connected and then load only connected agents.

Is this possible to load a connected in the jtable as soon as we figure out those are connected. So that swing application do not be in loading state.

and update the jtable successively


Thanks
Shailesh
 
Agador Paloi
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like you may want a seperate worker thread to update the JTable
 
Mikko Kohtamäki
Ranch Hand
Posts: 112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://java.sun.com/javase/6/docs/api/javax/swing/SwingWorker.html
http://java.sun.com/developer/technicalArticles/javase/swingworker/

doInBackground() handles all connected agents and calls publish(agent) for every connected agent and in process(List<Agent> agents) the connected agent's properties are inserted into table.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic