Little help updating my Jlabel


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Little help updating my Jlabel

  1. #1
    Join Date
    Mar 2005
    Location
    UK, London
    Posts
    150

    Little help updating my Jlabel

    Hi guys hope some one can help, i have an application,where by when u click a button a loop is executed, below is the code for the loop

    Code:
    for (int i=staport; i<=stoport;i++)
    		{
    		progress.setValue(i);
    			try
    				{
    				//a process happends here
    				}
    			catch (Exception e)
    				{}
    				scanOutPut.setText("<HTML>" + i +"<p></HTML>");
    					
    		}
    progress is a progress bar, what should happen is that the value of progress bar should imcremtent, when the loop is executed, and the progress bar should seem as though it is progressing. scanOutput is a jlabel which should display the value i. What seems to happen is that nothing is updated as the loop is being executed, only when the loop has finished, then the updates are shown. I hope you understand, if not I can explain more. Please can some one help me. It should update as the loop is executed.
    Last edited by major; 02-02-2006 at 09:23 PM.

  2. #2
    Join Date
    Feb 2006
    Location
    Cologne - Germany
    Posts
    271
    try an explicit update with:

    Code:
    progress.updateUI();
    scanOutPut.updateUI();
    or

    Code:
    progress.repaint();
    scanOutPut.repaint();
    this should help. if not, tell me.

Similar Threads

  1. Quick Question about JLabel
    By p1kn1c in forum Java
    Replies: 1
    Last Post: 01-25-2006, 02:35 AM
  2. preventing multiple users from updating recordset
    By Caroline in forum VB Classic
    Replies: 2
    Last Post: 03-24-2002, 12:21 AM
  3. Problem updating database w/two tables in VB6
    By Jade29 in forum VB Classic
    Replies: 3
    Last Post: 01-12-2002, 11:12 PM
  4. Updating
    By Matt in forum ASP.NET
    Replies: 0
    Last Post: 08-01-2001, 08:49 PM
  5. processing animated gifs in JLabel
    By Alan Shiers in forum Java
    Replies: 0
    Last Post: 05-22-2000, 11:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center