Results 1 to 4 of 4

Thread: JProgressBar

  1. #1

    Thread Starter
    Frenzied Member SomethinCool's Avatar
    Join Date
    Jan 2001
    Location
    Malvern, PA
    Posts
    1,407

    JProgressBar

    I have a JFrame with a button which connects to a SQL server. In the try-catch code, i have progressBar.setValue(*value*); methods. When the code is executed and it is connecting to the server, the progress bar doesn't update on the form.

    I read that this is due to the fact that the UI doesn't update the form until after the thread is done processing.

    Is there any type of Java equilvalent code to the VB.net code Application.DoEvents() (or VB6 DoEvents function)?

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: JProgressBar

    No DoEvents. In Java you're expected to use threads for long operations.

    However, there is a method to force a redraw of the windows immediately. I forgot its name.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Frenzied Member SomethinCool's Avatar
    Join Date
    Jan 2001
    Location
    Malvern, PA
    Posts
    1,407

    Re: JProgressBar

    its not JProgressBar1.UpdateUI(); is it? I tried that and it didnt work...

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: JProgressBar

    No, I'm talking about repaint().

    Mostly, though, if you really have a long task, you should just spawn a thread for it.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width