JProgressBar inside JDialogBox doesn't show up.

Hi,
I have a problem and kind of stuck.
Here is the scenario.....
Inside my actionPerformed method I create an instance of a class that extends java.lang.Thread and inside this class run method I create an instance of another class that extends JDialog that contains a JProgressBar. Now when a user clicks a button on the main application window the actionPerformed gets executed and it shows a JProgressBar and then continues the execution of the actionPerformed method while the JProgressBar keeps on updating the status. But the problem is that the JDialog shows up but the JProgressBar inside it doesn't even show. here is the code snippet I am using
public void actionPerformed(ActionEvent e)
//some code here
//class extends Thread and creates JDialog with JProgressBar in it
//JDialogBox with JProgressBar in it shows here
t = new ProgressThread();
t.start();
//some other code I do some other processing
//here I am hidding and destroying the JProgressBar
//inside the reset method I hide the JDialog and set it to null
t.reset();
//some more code
} //end of actionPerform
Now my problem is that JDialogBox does pop-up but the JProgressBar in it doesn't show. Any ideas what I am doing wrong. I even tried to create the instance of JDialog directly instead of using a separate Thread but it didn't work either.
Thanks for any help

The point being, AWT and Swing are, in general, not thread-safe.
You must not do anything that modifies the appearance of any visible Swing component, such as JProgressBar, from your thread. This must be done in the AWT Event Dispatch Thread. But when the components are not visible, like when you are building your GUI and haven't set it to visible yet, this doesn't apply.
What I do, when my threads need to update the GUI, is to create a Runnable to do it, then queue that to the AWT Event Dispatch Thread for execution by calling SwingUtilities.invokeLater(). Other people use this SwingWorker class.
Note that event listener methods are called in the AWT Event Dispatch Thread, so you need to worry about this only in your own thread.
It is said there are some Swing components that are thread-safe. Given the typical use of JProgressBar, too bad it isn't one of them.

Similar Messages

  • Indeterminate JProgressBar inside JTable cell

    I am able to put a JProgressBar inside a JTable cell, via a custom renderer to do so, however, I am unable to make the progress bar show the indeterminate animation. Any ideas? I calledbar.setIndeterminate( true ); and it doesn't seem to want to show. Is the JTable preventing it?
    (should I include more of my code?)

    Your JProgressBar is used to render the table cell only when that cell of the JTable needs to be rendered and the JProgressBar has no say in this.
    I don't know why you would want to do this but to do this I would set up timer that fired a tree model event to say that the content of the cell had changed. This would trigger the cell to be re-painted. I think, but I can't be sure, that you will not be able to use
    bar.setIndeterminate( true );
    You may have to craft your own progress bar to make this easy.

  • HT1338 I'm trying to download java on my Mac machine but the software update doesn't show me anything. Please advise what I should do to get the application.

    I'm trying to download java on my Mac machine but the software update doesn't show me anything. Please advise what I should do to get the application.

    If you can run it under chrome, you have java installed.
    There was some malware that exploited an older version of Java (not javascript) running in a Browser. Since few people use it Apple turned off Java by default in the Safari Browser.
    If you need it for something, just turn it back on in Safari preferences (inside Safari). After a few months of non-use, you may find it has turned itself off again.

  • IMovie crashed now .rcproject file doesn't show in library/project list and won't open.

    URGENT PROJECT DUE TODAY.
    iMovie crashed while I was working on a project, now I can't c the file in iMovie, however I can see it in Finder and moved to the movie folder, but it still doesn't show in my iMovie library or project list and nothing will open it.  It is listed as a .rcproject and I cannot find how to open it.  PLZ PLZ HELP

    Were you working with iMovie 9 or 10 when you had the crash?
    It sounds like you were in iMovie 10 trying to update your iMovie 9 projects into iMovie 10.
    If you were working in iMovie 10, see if you can still see everything with iMovie 9.0.9 (the 2 versions have completely different media file structures).
    If you were in iMovie 9 it sounds as if the .rcproject package may have got corrupted.  You can look inside the package in Finder with the "show package contants" contextual menu but I would not know how to repair it manually. 
    Do you have a backup or are you running time machine?  With a backup you should be able to replace the offending package with a working version.

  • I changed my username and now afp doesn't show any users. I have file sharing on. And also when I select "get more info" on the shared folders they don't have my username in there. it just has "applepc(me)" it my old username before changing it.

    I changed my username and now afp doesn't show any users. I have file sharing on. And also when I select "get more info" on the shared folders they don't have my username in there. it just has "applepc(me)" my old username before changing it showed the correct username? please any help would be great.

    Turn Time Machine OFF temporarily in its preference pane. Leave the window open.
    Navigate in the Finder to your backup disk, and then to the folder named "Backups.backupdb" at the top level of the volume. If you back up over a network, you'll first have to mount the disk image file containing your backups by double-clicking it. Descend into the folder until you see the snapshots, which are represented by folders with a name that begins with the date of the snapshot. Find the one you want to restore from. There's a link named "Latest" representing the most recent snapshot. Use that one, if possible. Otherwise, you'll have to remember the date of the snapshot you choose.
    Inside the snapshot folder is a folder hierarchy like the one on the source disk. Find one of the items you can't restore and select it. Open the Info dialog for the selected item. In the Sharing & Permissions section, you may see an entry in the access list that shows "Fetching…" in the Name column. If so, click the lock icon in the lower right corner of the dialog and authenticate. Then delete the "Fetching…" item from the icon list. Click the gear icon below the list and select Apply to enclosed items from the popup menu.
    Now you should be able either to copy the item in the Finder or to restore it in the time-travel view. If you use the time-travel view, be sure to select the snapshot you just modified. If successful, repeat the operation with the other items you were unable to restore. You can select multiple items in the Finder and open a single Info dialog for all of them by pressing the key combination option-command-I.
    When you're done, turn TM back ON and close its preference pane.

  • Please help me out! my ipod doesn't show any thing in my screen.

    please help me out! my ipod doesn't show any thing in my screen. please can someone helphelp me please T^T.
    or could someone teach me to open a ipod photo on. i want to check inside is it find?

    Try resetting it. If that doesn't help, try restoring it.
    There are no user serviceable parts inside an iPod, and opening it will void the warranty.

  • Pages import doesn't show portlets

    hi,
    we have 3 pages with multiple portlets.
    portlet contains forms and reports and other components.
    we exported pages with pageexp utility.
    when we import it , we cannot get the whole page,instead it shows only the tabs not the content and application components inside the tabs.even we click the tabs, it doesn't show anything.
    pl. help us
    thks in advance.
    regards
    kathir
    null

    You need to export the components also. For this, you can export the application(s) having the components, save the .SQL file. Run the .SQL file in your new installation.

  • App doesn't show up after it downloads.

    I rebooted the iPad but it still doesn't show up. What's the problem?

    I just read on another thread that some users can't find IBooks after they download it. A hard reset was recommended. Hold down on the sleep and home buttons simultaneously for about 10 seconds until the Apple logo appears, ignore the red slider, let go of the buttons and let the iPad restart.
    The app may also be on another screen so try swiping from screen to screen and look inside any folders you have as well.

  • New Superdrive doesn't show up in System Profiler

    My old superdrive died on me, so I ordered a new one from powerbookmedic.com.
    After installing, it doesn't show up in System Profiler. I've quadruple-checked the connection and I can hear it make regular healthy sounds when booting up so I know it's getting power but once I'm inside OSX; nothing.
    I tried resetting the PRAM and SCM as recommended on this forum for various superdrive trouble. Although it didn't change anything and I'm guessing don't apply here.
    Any tips for getting OSX to recognize my drive?

    It's equipped with a SATA drive - that's why.
    Just take a look further down ..
    Printers
    SAS
    Serial-ATA <--
    USB

  • External drive doesn't show up.

    I have a LaCie mini hub external drive that I use as a backup drive for my Mac Mini. Well, the drive in the Mini died. I took the LaCie to the Apple store with the Mini and they confirmed that the external drive was working OK, by either USB or Firewire. They kept the Mini for warranty repair and I'm still waiting for it to return.
    I get home and attach the LaCie drive to my ibook, but the ibook doesn't see it. It doesn't show up with system profiler, so I can't even try running Disk Utilities on it. The hub function of the LaCie seems to work OK, but that's probably not surprising, and has little to do with the hard disk inside it.
    The Mini is a intel duo core running OS X 10.4.8
    The ibook is a G4 running OS X 10.3.9
    The LaCie is 250 GB, formatted using HFS+, according to the manual.
    Mostly I just want to reassure myself that the backup is intact on the LaCie drive. Any thoughts?
    ibook G4   Mac OS X (10.3.9)  

    Mostly I just want to reassure myself that the backup is intact on the LaCie drive. Any thoughts?
    You might have a look at the demo version of iPartition.
    http://www.coriolis-systems.com/iPartition.php
    The demo won't write any changes, so hopefully it is a safe way to confirm that you still can access your drive -- though it won't actually let you get the contents, since it is a partitioning utility.
    (If it were me, I'd leave well enough alone until your fixed Mini returns.)

  • Object tree doesn´t shows object tables

    SQLDeveloper 1.5 doesn´t shows object tables inside Tables folder
    earlier versions do so
    Thanks

    no, it didn't but it is on our feature request lists.

  • Excel doesn't show NAME in the brackets.

    Hi I have a strange problem. Excel addin for MDS doesn't show {NAME} for a particular field. All other fields are ok, but one of them simply doesn't show the NAME in the brackets. This attribute is domain-based and is set up EXACTLY like other fields in
    the same and other entities. The field is Org_Unit. Anybody have any idea?
    P.S. This field down't even show dropdown list...
    P.P.S. Org_Unit entity has 42 000 records. Might it be a reason???

    1.
    Ihave the same problemover 25,000records.
    Moreover, sometimes in the Excel-file is not shown code.
    Apparently something is broken inside the Excel-file
    2.
    Not supported (reset) the format cells after refresh.
    3.
    After refresh -  the table is  placed in the first row again! Although in the first rows I inserted a blank rows for the business captions (Rus).
    Some disappointment
    from Moscow with money

  • Finder doesn't show recent pictures anymore

    My finder does not show pictures anymore that are imported in iTunes in the last months. What to do? This problem started some weeks ago.
    iMac 17"   Mac OS X (10.4.8)  

    MacAlf
    Does iPhoto show them? If so, right click on a photo and select 'Show File'. This will open a finder window with the file highlighted.
    If you want to access a file Drag and drop it to the Desktop, this will create a copy of the file there. Or you can use File -> Export, which will also create a copy.
    Remember, iPhoto is a database, and like all databases is designed so that you access the data - in this case your pictures - via the application, not through the Finder.
    It is strongly advised that you do not move, change or in anyway alter things in the iPhoto Library Folder as this can cause the application to fail and even lead to data loss
    A Note about the iPhoto Library Folder in v6:
    In this folder there are various files, which are the Library itself and some ancillary files. Then you have three folders
    Originals are the photos as they were downloaded from your camera or scanner.
    (ii) Modified contains edited pics, shots that you have cropped, rotated or changed in any way.
    This allows the Photos -> Revert to Original command - very useful if you don't like the changes you've made.
    (iii) Data holds the thumbnails the the app needs to show you the photos in the iPhoto Window.
    Inside each of these folders there will be rolls arranged based on date.
    If iPhoto doesn't show them, then they have not been successfully imported.
    Hope this helps. If it doesn't. I suggest that you try the iPhoto Forum.
    Regards
    TD

  • Spotlight shows the result of old files doesn't shows words definition

    Hi all,
    I am sick of my spotlight searchings, firstly it doesn't shows the latest file result as if i create a new document file it doesn't shows its existence and the matter inside that file plus one more than previously i used my spotlight for words definition which came from dictionary now it also doesn't shows that thing as well, from different forums i have search that for re indexing put the hd drive into spotlight preference privacy and than delete that, what i did i drag the hd drive into privacy setting quit spotlight preference and system preference and than open again spotlight preference and in the privacy tab it's nothing there the drive which i just added a few minutes back it was not there so how would i delete it again for re-indexing. i am running mac os x 10.6.6. Pleas help Me thanks =)

    Could be many things, we should start with this...
    "Try Disk Utility
    1. Insert the Mac OS X Install disc, then restart the computer while holding the C key.
    2. When your computer finishes starting up from the disc, choose Disk Utility from the Installer menu. (In Mac OS X 10.4 or later, you must select your language first.)
    *Important: Do not click Continue in the first screen of the Installer. If you do, you must restart from the disc again to access Disk Utility.*
    3. Click the First Aid tab.
    4. Select your Mac OS X volume.
    5. Click Repair Disk, (not Repair Permissions). Disk Utility checks and repairs the disk."
    http://docs.info.apple.com/article.html?artnum=106214
    Then try a Safe Boot, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, reboot when it completes.
    (Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive.)
    If perchance you can't find your install Disc, at least try it from the Safe Boot part onward.

  • Album artwork doesn't show up on Get Info window?

    I downloaded iTunes 7. Now, when I open the Get Info window and go to the artwork tab, the artwork doesn't show up, even though I can see it in the regular iTunes window! Help? Anyone?

    iTunes 7 does some stupid things with the artwork. The artwork tab in Get Info is the artwork that is contained inside the music file. iTunes 7 also downloads artwork for songs but then it doesn't store it inside the song file -- it just puts in in a folder on the computer.

Maybe you are looking for