ProgressMonitor dialog doesn't go away

When I run the ProgressMonitor demo found in the tutorial (on [http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html#monitors|http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html#monitors] ), the ProgressMonitor doesn't go away when the task is complete.
If I press the "Start" button again, I get two ProgressMonitors, one showing the old status of 100%, and another one showing the current progress. (You have to move the dialog windows around to see both of them.)
How do I make the ProgressMonitor dialog disappear? Calling the close() method doesn't do it.
Claus

I don't understand this. I have a problem with a demonstration program that is available on Sun's own web site. The program is already extremely short and concise. Do you want me to download it and upload it again?
Anyway, here it is:
* Copyright (c) 1995 - 2008 Sun Microsystems, Inc.  All rights reserved.
* [rest of copyright comment removed. Please forgive me, Sun.]
package components;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.beans.*;
import java.util.Random;
public class ProgressMonitorDemo extends JPanel
                                 implements ActionListener,
                                            PropertyChangeListener {
    private ProgressMonitor progressMonitor;
    private JButton startButton;
    private JTextArea taskOutput;
    private Task task;
    class Task extends SwingWorker<Void, Void> {
        @Override
        public Void doInBackground() {
            Random random = new Random();
            int progress = 0;
            setProgress(0);
            try {
                Thread.sleep(1000);
                while (progress < 100 && !isCancelled()) {
                    //Sleep for up to one second.
                    Thread.sleep(random.nextInt(1000));
                    //Make random progress.
                    progress += random.nextInt(10);
                    setProgress(Math.min(progress, 100));
            } catch (InterruptedException ignore) {}
            return null;
        @Override
        public void done() {
            Toolkit.getDefaultToolkit().beep();
            startButton.setEnabled(true);
            progressMonitor.setProgress(0);
    public ProgressMonitorDemo() {
        super(new BorderLayout());
        //Create the demo's UI.
        startButton = new JButton("Start");
        startButton.setActionCommand("start");
        startButton.addActionListener(this);
        taskOutput = new JTextArea(5, 20);
        taskOutput.setMargin(new Insets(5,5,5,5));
        taskOutput.setEditable(false);
        add(startButton, BorderLayout.PAGE_START);
        add(new JScrollPane(taskOutput), BorderLayout.CENTER);
        setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
     * Invoked when the user presses the start button.
    public void actionPerformed(ActionEvent evt) {
        progressMonitor = new ProgressMonitor(ProgressMonitorDemo.this,
                                  "Running a Long Task",
                                  "", 0, 100);
        progressMonitor.setProgress(0);
        task = new Task();
        task.addPropertyChangeListener(this);
        task.execute();
        startButton.setEnabled(false);
     * Invoked when task's progress property changes.
    public void propertyChange(PropertyChangeEvent evt) {
        if ("progress" == evt.getPropertyName() ) {
            int progress = (Integer) evt.getNewValue();
            progressMonitor.setProgress(progress);
            String message =
                String.format("Completed %d%%.\n", progress);
            progressMonitor.setNote(message);
            taskOutput.append(message);
            if (progressMonitor.isCanceled() || task.isDone()) {
                Toolkit.getDefaultToolkit().beep();
                if (progressMonitor.isCanceled()) {
                    task.cancel(true);
                    taskOutput.append("Task canceled.\n");
                } else {
                    taskOutput.append("Task completed.\n");
                startButton.setEnabled(true);
     * Create the GUI and show it.  For thread safety,
     * this method should be invoked from the
     * event-dispatching thread.
    private static void createAndShowGUI() {
        //Create and set up the window.
        JFrame frame = new JFrame("ProgressMonitorDemo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //Create and set up the content pane.
        JComponent newContentPane = new ProgressMonitorDemo();
        newContentPane.setOpaque(true); //content panes must be opaque
        frame.setContentPane(newContentPane);
        //Display the window.
        frame.pack();
        frame.setVisible(true);
    public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
Claus

Similar Messages

  • ProgressMonitor dialog will not popup

    Can anybody tell me what's wrong with the following code? The ProgressMonitor dialog never pops up.
    class OkListener implements ActionListener
    public void actionPerformed(ActionEvent ae)
    Runnable task = new Runnable()
    public void run()
    String login = _getJTFLogin().getText();
    String pwd = new String(_getJTFPassword().getPassword());
    ProgressMonitor progMon = new ProgressMonitor(_parent, "Please wait...", "Authentification", 0, 100);
    progMon.setProgress(0);
    progMon.setMillisToDecideToPopup(1000);
    try
    doAuthentification(login, pwd);
    catch (Exception exc)
    exc.printStackTrace();
    finally
    progMon.close();
    Thread worker = new Thread(task);
    worker.start();
    And, somehow, if I add a fake Thread.sleep() call and a progMon.setProgress(50) after the doAuthentification() method, the dialog pops up.
    Any logic to this? I have read the documentation but nothing seems to explain this behavior.
    Thanks a lot!
    Guillaume

    From mentioning the DIALOGEX, it sounds like you've read one of my many posts on the subject (or figured it out for yourself). An easy may to see if that's the still the problem is when the dialog doesn't show up, it should act like there's a modal dialog you just can't see. I.e., you can't click on AI's menus, panels or the document. If that's the case but when you hit ESC it acts like the invisible dialog has disappeared, it's probably still the DIALOGEX thing in some way. I might have a suggestion or two on that score if that's the case.
    Code-wise though, you look fine. So I always strongly lean towards that stupid DIALOGEX problem.

  • When I am connected to my home wifi, it says I am connected but the 4G icon doesn't go away.  How can I make that go away when I am connected?

    When I am connected to my home wifi, it says I am connected but the 4G icon doesn't go away.  How can I make that go away when I am connected?

    When I'm at my home, and on my Wifi, my 4G icon on my LG G2 is still present. No big deal. If the bits can flow via WiFi, that's what they'll do.
    You might try (if you really MUST shut off the cellular radio):
    Settings, Network Connections and More networks. Select Mobile Networks and uncheck Mobile data and data roaming.
    Not sure if that will work - but give it a try.

  • Import dialog doesn't appear (OS X)

    When I connect my SanDisk Firewire memory card reader to my Mac Pro, Lightroom doesn't open and the import dialog doesn't appear. This worked fine on my previous G5. iPhoto isn't opening either... nothing happens at all when I plug in the reader.

    Chris, you may have already done this, but be sure to check 'Show Import Dialog when a Memory card is detected' under Import in LR PReferences, as well.
    Don
    Don Ricklin, MacBook 2Ghz Duo 2 Core running 10.5.1 & Win XP, Pentax *ist D See LR Links list at http://donricklin.blogspot.com for related sites.

  • The dialogs doesn't show up over HTTPS connection.

    JWS usually shows Version check and Launching dialog when it start up.
    But when it started over HTTPS connection, those dialogs doesn't show up.
    When we use HTTP connection, the application launch by following step.
    1. Java loading dialog shows
    2. Version check dialog shows
    3. Launching application dialog shows
    4. Application launched
    However, in the case of HTTPS connection, step2, 3's dialog doesn't show up.
    (It might be skipped? What's going on?)
    I think that the step1,2,3 are processed by JavaWebStart.
    Is there any way to show these dialogs when we use HTTPS connection?
    Client: Windows XP(SP2), JDK: 1.4.2_06
    Web Server: WebLogic(ver.8.1)

    When running over http or file protocol, these dialogs are shown if the update check takes more than 1500 ms, when application must be updated before launching (due in 1.5.0 to offline-allowed not being specified, or setting <update check="always" /> in 6.0) (assuming target isn't using basic authentication). If the update check can complete in less time than that, then the dialogs will not be shown.
    For https, there is a probability that the attempted https connection will cause https security dialogs, which would then always cause the check to take more than 1500 seconds (or whatever timeout is configured) so webstart won't show the download progress dialog untill it knows there is an update.
    This should be a bug, since it is handled beter in BasicAuthentication case.
    If you are using Authentication, the download dialog will show up only after 1500 ms if the JAuthenticator chalange dialog is not being shown.
    Similarilly, using https, he dialog should show after 1500 ms (or whatever timeout) if the https security dialog, or host mismatch dialog is not showmin.
    /Andy

  • "See how to get instant updates on your phone" Doesn't go away. Help?

    In the Facebook app when I click on the notifications it says "See how to get instant updates on your phone" at the top. It doesn't go away from the top unless I enable push notifications for it. However, i don't want that. Help?

    There are 3 ways to exit a fullscreen app:
    Escape key
    Command+Control+F
    Hover the cursor at the top of the screen until the menu bar drops down then clcik the Arrow icon on the top right.
    Have you tried plugging it back into the TV?

  • I want to delete a group on my iChat list, but it doesn't go away when I right click and delete it. No ones in the group and I tried the plus button on the bottom left of the list and I can't find "edit groups"

    I want to delete a group on my iChat list, but it doesn't go away when I right click and delete it. No ones in the group and I tried the plus button on the bottom left of the list and I can't find "edit groups"

    WordPress is in a class of it's own.  It began it's open source life as a blogging system but it has evolved into a powerful, feature-rich CMS (content management system).  In short, if you elect to use WordPress on your domain, you might just as well use it for your entire web site.
    To work with WordPress, you will need a firm understanding of HTML, CSS and how PHP includes work.
    WP requires you to set-up a dynamic work environment (see links below)
    Find a WP Theme you like that won't require much customizing on your part.
    Related Links:
    http://wordpress.org/
    Get one of the following testing servers for your OS and follow the installation instructions.
    WAMP for Windows
    http://www.wampserver.com/en/
    XAMPP for Windows
    http://www.apachefriends.org/en/xampp-windows.html
    XAMPP for Mac
    http://www.apachefriends.org/en/xampp-macosx.html
    MAMP for Mac
    http://www.mamp.info/en/downloads/index.html
    Setting up a PHP development environment for Dreamweaver
    http://www.adobe.com/devnet/dreamweaver/articles/setting_up_php_05.html
    Creating a WordPress Theme in DW
    http://www.adobe.com/devnet/dreamweaver/articles/creating_wordpress_theme_with_dreamweaver _pt1.html
    Best of luck,
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb
    http://alt-web-design.blogspot.com/

  • Trial version banner doesn't go away

    The trial version banner doesn't go away in the full version in modified parts made in the trial version. Normal video is clean, but transitions and modfied parts keep having the trial stamp.
    regrads,
    Simon

    Kevin,
    My guess would be that this is Premiere Elements, which DOES have a watermark applied, when used in the trial version. If this guess is correct, then this PrE FAQ Entry should be helpful: http://forums.adobe.com/thread/433730?tstart=30
    As the OP has found, just adding the S/N, to convert from trial mode to full-paid mode, when one has an existing Project, done in the trial mode, will not remove the watermark from THAT Project - Removal of the Render Files is also required. Also, see Reply #8 for clarification from Adobe: http://forums.adobe.com/message/4797656#4797656
    If the Timeline has been Exported (Shared, or Publish+Share in later versions of PrE), there is no way to remove the watermark from that output file. Also, one DOES need to Delete those Render Files, from the Project, to then output the Timeline without the watermark.
    Hope that this helps, and you might want to Move this thread to the PrE Forum.
    Hunt

  • Missing File Error Dialog won't go away

    I successfully ported my iWeb 1 site on my iMac to my MacBook and to iWeb 2. Made a bunch of changes and successfully published to my .mac page (it is up and correct). I placed the Domain file on my desktop on the new computer. However, when I try to open the Domain page it opens my site but gives an error dialog over the main window saying "The following errors occurred when trying to open this file: Missing file (then file name), missing file (then file name), etc." I have the option to 'Continue' but when I click on it nothing changes, the dialog won't go away. I've quit iWeb but it does the same thing every time. So,
    A. How do I get this dropdown dialog to go away so I can work on the site (which is now missing all these picture files (which were on the same computer)).
    B. Why would the files which were working fine Sat. be 'missing' now. No file locations (domain or pictures) have been changed since then?
    Thanks

    mjj,
    Same thing with an older Epson Perfection 1200, two users (one admin and one not), in OSX 10.3.9. At least I can get rid of the dialog box.
    Epson Scan works fine for the admin user. Epson were useless, "check the cable" they said. And re-install the software.
    If you have any advice from Epson about getting it, even temporarily, working, I'd be delighted.

  • The mouse cursor doesn't go away when you are working

    Okay, so the problem is that the mouse cursor doesn't go away when you select a tool. It turns into a mouse cursor with a precision cursor as an attachment. I have been all over the internet and the manuel and can't figure out how to get my regular cursor back TT^TT.

    What happens when you press the Caps Lock key?  Do you get a combination mouse cursor and brush size cursor?
    Cursor problems often involve the display driver, and can also be a result of using a large text size setting in Windows.
    Visit the web site of the maker of your video card and see if there's a newer version of the display driver available to download and install.
    It doesn't sound exactly like what you're seeing, but if the display driver update doesn't help, check this knowledge base article:
    http://kb2.adobe.com/cps/500/cpsid_50020.html
    -Noel

  • The volume square doesn't go away

    What do I do if the volume square doesn't go away even though I tried resseting it

    - Try cleaning out/blowing out the headphone jack. Try inserting/removing the plug a dozen times or so. There is a little switch in the headphone jack that disconnects the speaker when the headphone jack is inserted.
    Try the following to rule out a software problem
    - Reset the iOS device. Nothing will be lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears. Done
    - Reset all settings
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup
    - Restore to factory settings/new iOS device.
    - Make an appointment at the Genius Bar of an Apple store. Seems you have a bad headphone jack or other hardware problem.
    Apple Retail Store - Genius Bar
    If not under warranty Apple will exchange your iPod for a refurbished one for this price. They do not fix yours.
    Apple - iPod Repair price                  

  • My screen saver doesn't go away when I start to work.  It runs in the background on my desktop

    My screen saver doesn't go away when i start to work.  It continues to run in the background on my desktop.

    Sounds like it needs it's preferences reset.
    In Finder choose Go>Go To Folder. Enter ~/Library/Preferences/com.apple.screensaver.plist
    Click go.
    Drag the com.apple.screensaver.plist to your desktop.
    Log out and back in and test.
    If solved delete from desktop.
    Hope this helps.
    PJRS

  • My voicemail notification doesn't go away on my 3GS but I have no voicemail

    My voicemail notification doesn't go away on my 3GS but I have no voicemail. My phone has been shut off and when it restarts I get the popup saying new voicemail as well, but there is none.

    Follow the instructions under the heading "How to unlink a phone number" on this page.

  • Instagram notification doesn't go away automatically on status bar

    instagram notification doesn't go away automatically on status bar even if i open the app through tthe notification.
    it was on going on ios6, and is till going on in ios 7.
    does anyone have fix for this?

    This problem is still going on for me...

  • Calendar reminder doesn't go away!

    Every so often, when I set a reminder on my calendar, it doesn't go away!
    Whether I close it, or snooze it, it comes back shortly after and doesn't go away until the event it over.
    If it's a full day event, if stays on all day!
    Restarting the computer doesn't seem to help.
    Any suggestions?
    Thanks

    Hey jamesfrombryan!
    That red dot indicates that an invitation was sent to you in the Calendar. Here is an article that can explain how to address this invitation:
    Calendar (Mavericks): Reply to event or calendar invitations
    http://support.apple.com/kb/PH14977
    Thanks for coming to the Apple Support Communities!
    Regards,
    Braden

Maybe you are looking for