🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #1977

Re: Freeze the screen

#1977
From: Ant�nio Ferreira
Date: Mon, 18 Jun 2001 10:31
76 lines
2838 bytes
Hi,

  due to some problems the message wasn't well sent. So I will send the code
snippet again.
  Here it goes:

/************************************/
  public void refreshCards() {

    if (this.finishedThread) {
      this.finishedThread = false;
      /*inicializes the frame that has the progress bar*/
      final ProgressBar1 bp = new
ProgressBar1(0,97+(this.jTabbedPaneCartas.getComponentCount()*8),"Cards
actualization");
      bp.show();
      final SwingWorker worker = new SwingWorker() {
          public Object construct() {
              refreshCardsThread(bp);
              return null;
          }
      };
      worker.start();
    }
  }

  public void refreshCardsThread(ProgressBar1 bp) {

    /*unimportant code*/
    ...

    /*updates the progress bar by a value of 10 */
    bp.updatevalue(10);

    /*it calls a method that re creates the screen*/
    /*I don�t intend to call the progress bar inside this method*/
    /*only after it, to simplify things*/
    this.recreatescreen();
    bp.updatevalue(50)
    ...
    this.finishedThread = true;
 }

/**********************************/

I hope this can help. Thanks

  Ant�nio Jos� Ferreira

"Torsten Welches" <torsten.welches@who.cares.netcologne.de> wrote in message
news:3b29bd14$1_1@dnews...
>
> Ant�nio,
>
> can you provide a code snippet that shows what you are doing?
>
> Torsten
>
> "Ant�nio Ferreira" <antonio.ferreira@artesis.co.pt> wrote:
> >Hi,
> >
> >  I am using the swingworker to implement the progress bar but I am
having a
> >problem. During the execution of the thread I need to recreate the
screen.
> >Without the progress bar the screen is updated in the end but with the
> >progress bar this one is being updated while the thread is running. Is
there
> >something I can do to update the screen only when the thread is over?
> >  I appreciate all your help.
> >  Thanks,
> >
> >  Ant�nio Jos� Ferreira
> >
> >
>
Technical Details
Message-ID: <3b2dd800_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!hub.org!hub.org!PeerFeed.KWeb.on.ca!dnews
References: <3b27452c_1@dnews> <3b29bd14$1_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 1089d0,18c80611e0e8e298
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2001-06-18 03:36:59 PST
From: "Ant�nio Ferreira" <antonio.ferreira@artesis.co.pt>
Newsgroups: borland.public.jbuilder.java.api
References:  <3b27452c_1@dnews>  <3b29bd14$1_1@dnews>
Subject: Re: Freeze the screen
Date: Mon, 18 Jun 2001 11:31:35 +0100
Lines: 78
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
NNTP-Posting-Host: 195.22.4.82
Message-ID: <3b2dd800_1@dnews>
X-Trace: dnews 992860160 195.22.4.82 (18 Jun 2001 03:29:20 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!hub.org!hub.org!PeerFeed.KWeb.on.ca!dnews