Changing gui by pressing a button


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Changing gui by pressing a button

  1. #1
    Join Date
    Apr 2008
    Location
    Switzerland
    Posts
    11

    Changing gui by pressing a button

    Hi

    My problem is: I have a panel with pictures in it and a progress bar, everything as an object with methods to set the pictures and to clear them all.

    If I create the Object and set the pictures later in the code, everything works well. I can see the pictures appear and the progress bar is changing (I am calling updateUI() after each picture is loaded).

    If I want to refresh everything by pressing on a button, it sets the pictures, but nothing is updating (also the progress bar is not changing) until everything is finished.

    Can anyone tell me why this happens?
    Is there a problem that the method to reset the pictures is called inside an ActionListener class, and therefore it is not possible to call updateUI()?

    thanks for your help...

  2. #2
    Join Date
    May 2008
    Posts
    1
    Hello,

    could you post your code so can we identify what's not going on..

  3. #3
    Join Date
    Apr 2008
    Location
    Switzerland
    Posts
    11
    Hmm the code is pretty big....

    I solved the problem by using a Thread. To update the pictures in the panel, I am starting a new Thread which sets the pictures and updates the progress bar.

    I am not so sure why I need that. I just read in tutorials for the progress bar that it is not possible to, for example, do a calculation and update the progress bar within one thread. Does anyone has a good explanation for this? Is it because the Thread is busy with calculating, the UI doesnt gets updatet?

  4. #4
    Join Date
    May 2007
    Posts
    843
    Every thread has a different memory in stack.

  5. #5
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Quote Originally Posted by mabuhay
    do a calculation and update the progress bar within one thread. Does anyone has a good explanation for this? Is it because the Thread is busy with calculating, the UI doesnt gets updatet?
    It is because you have no way of determining where in the calculation process the code is at any given moment.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. Pseudocode Problem
    By zobi316 in forum VB Classic
    Replies: 3
    Last Post: 03-10-2008, 08:05 AM
  2. Replies: 8
    Last Post: 05-23-2007, 01:31 PM
  3. Getting a GUI to run
    By Eric in forum Java
    Replies: 4
    Last Post: 04-14-2006, 10:09 AM
  4. Need help with calculator...
    By 2eXtreme in forum Java
    Replies: 0
    Last Post: 04-05-2006, 08:38 AM
  5. Getting a GUI to function
    By Eric in forum Java
    Replies: 1
    Last Post: 11-27-2001, 07:53 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