How do you dispose a thread-handled modal dialog not thru some actions?

The code almost looks like this:
/* Thread that disposes the dialog when the time in seconds is "9" */
class AboutThread extends Thread {
private volatile Thread about;
AboutDialog ad;
AboutThread(AboutDialog ad) {
this.ad = ad;
public void stopped() {
about = null;
ad.dispose();
ad = null;
System.gc();
public synchronized void run() {
Thread thisThread = Thread.currentThread();
about = thisThread;
System.out.println("About thread is running!");
ad.start();
while (about == thisThread) {
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
     System.err.println("Thread.sleep error: " + ex);
String s = new String(getCurrentDateTime("s"));
if (s.equals("9")) {
ad.setVisible(false);
ad.setModal(false);
ad.setVisible(true);
System.out.println(9);
this.stop();
/* Shows a dialog describing the User Log application */
public class AboutDialog extends Dialog implements ActionListener {
public AboutDialog(Frame parent, String title) {
     super(parent, title, false);
     Panel labelPanel = new Panel();
     labelPanel.setLayout(new BorderLayout());
     labelPanel.setBackground(Color.gray);
JLabel jlab = new JLabel("User Log 1.0");
jlab.setHorizontalAlignment(SwingConstants.CENTER);
jlab.setFont(new Font("Monospaced", Font.BOLD, 28));
JLabel jlab1 = new JLabel("Copyright(c) 2001 Soft Wares. All Rights Reserved.");
jlab1.setHorizontalAlignment(SwingConstants.CENTER);
labelPanel.add(jlab, "Center");
     labelPanel.add(jlab1, "South");
     add(labelPanel, "Center");
     Panel buttonPanel = new Panel();
buttonPanel.setBackground(Color.gray);
     Button okButton = new Button("OK");
     okButton.addActionListener(this);
     buttonPanel.add(okButton);
     add(buttonPanel, "South");
     setSize(400, 130);
     setLocation(parent.getLocationOnScreen().x + 200,
          parent.getLocationOnScreen().y + 200);
public void start() {
show();
public void actionPerformed(ActionEvent e) {
     setVisible(false);
     dispose();
at.stopped();
}

ooops! i'm sorry. in the AboutDialog Class, it should be "super(parent, title, true)" for it to be modal.
anyway, it seemed that posting the partial code above of the whole app is not so understandable.
what i like to address here is that: how do i dispose or get rid of the thread-dispatched modal dialog by not making mouse clicks or any other user intervention? i wanted it to be disposed by the same thread, which dispatched it, when a certain variable value (global or local) is met. is this possible?

Similar Messages

  • How can you keep the caps lock on and not unlock after each letter?

    How can you keep the caps lock on and not unlock after each letter?

    I'm not aware of an online keyboard that is available and can do this. Most likely it would need to be a function of the app itself (which can and sometimes do add functionlaity to the keyboard).
    Wireless keyboard might handle that, if that's an option for you.
    I work in IT myself, and IMHO the iPad isn't the ideal device for coding or scripting work.

  • How do you use the Multiple Item Information dialog box ???

    How do you use the Multiple Item Information dialog box ???
    Where are the instructions on how the information in the Multiple Item Information dialog box equates to ...
    1. The way iTunes sorts tracks and albums
    2. The reason to select a leading check box
    3. Why there are Option selections (Yes /No) and leading check boxes.
    4. Why some changes remain in the track info, but do not "take effect" in iTunes (Part of a compilation is an example)
    Looked in Help, Support, went to the local Genius bar for an hour, even arrainged a call from apple support ...
    Thanks

    As Christopher says, it's a compilation. Different tracks are by different artists.
    Setting the *Album Artist* field to *Various Artists* and setting *Part of a compilation* to Yes should be all that is required. Depending on your *Group compilations when browsing* setting ( I recommend On ) either should suffice but I suggest doing both.
    Based on your commentary, I selected all the "O Brother" tracks, and checked the boxes for everything line that was blank in the Info and the Sort panes. Only exceptions were the album name and the disc number 1 of 1 and the artwork. I blanked and checked anything else.
    That's not what I meant. When you select multiple tracks, only those values which +are already common+ to all tracks are displayed. Typically these will include Artist, though not with compilation albums, Album Artist, Album, No. of Tracks, Genre plus various sort fields. A blank value may indicate that different tracks have different values or it may be that the value is blank for all tracks. For the drop down values on the Options tab the value shown may not reflect the information in every tag. If values you expect to be common, such as Album Artist or the Album title are not displayed you can simply type these in and click OK. This will often be enough to group the album.
    If you place a checkmark against the blank boxes and apply changes then you will clear those fields so you should only do this if that is the effect you want. Putting a checkmark next to an empty (representing different values) *Track No.* box, for example, will just clear the all the track numbers which is very rarely useful.
    Adding then removing extra text is for a specific problem where despite all common values being identical across the tracks of the album iTunes seems to "remember" that it should see two albums. A typical example would be when an album originally listed as *Album CD1* & *Album CD2* is given disc numbers X of Y and then has the Album name changed to Album. I've seen iTunes merge all but one track into the new album, but insist on listing one remaining track separately, despite both albums having the same title. In this case I've found overtyping the album title again has no effect whereas changing it to AlbumX and then back to Album does what I was trying to achieve in the first place.
    Don't forget that even properly organsied albums may still break up if you don't chose an album-friendly view. Sorting on the track name or track number columns can be useful in some circumstances but in general I revert to Album by Artist when browsing through my library.
    tt2

  • HT201365 I just updated to ios 7 on my iPhone 4 how do you turn the apps off when your not using them? The old way of double clicking and then pressing the app until a red minus button comes doesn't work it opens it back up!?

    I just updated to ios 7 on my iPhone 4 how do you turn the apps off when your not using them? The old way of double clicking and then pressing the app until a red minus button comes doesn't work it opens it back up!?

    Double click home button, then swipe up on app picture (not the icon itself)

  • HT201737 how do you close a thumb drive that does not show in finder?

    How do you close a thumb drive that does not show in finder?

    What do you mean by "Close?"
    Eject??
    If so, you could use Go to Computer to find it if it is not in the Sidebar or on the Desktop. Ctrl-click or Right-click on the drive and choose Eject <diskname>
    Or, you could set it to show in the SideBar in the Finder Preferences, SideBar tab. Then, it would have an eject icon next to it in the Sidebar.

  • How can you sync ipad 2 photos to pc not using the cable or icloud sync?

    How can you sync ipad 2 photos to pc not using the cable or icloud sync? Is there a way to do this via wi-fi network, How can you sync ipad 2 photos to pc not using the cable or icloud sync? Is there a way to do this via wi-fi network

    Thanks for that, that was my first suggestion but he wants to not email either. His problem is he used his old nokia to do it and it was fine, now anything other than that he thinks is too much hassle.

  • How do you auto reconnect a live video stream broadcast in flash action script 3?

    how do you auto reconnect a live video stream broadcast in flash action script 3?
    so i don't have to ask people to refresh the page if the connection drops
    i copy pasted the live video stream broadcast files and script from here;
    http://www.adobe.com/devnet/adobe-media-server/articles/beginner_live_fms3.html
    http://www.adobe.com/content/dotcom/en/devnet/adobe-media-
    server/articles/beginner_live_fms3/_jcr_content/articlePrerequistes/multiplefiles
    /node_1278314297096/file.res/beginner_live_fms3.zip
    i don't know what i'm doing

    Why don't you use several layers with appropriate alpha properties, and move these layers according to the mouse events?

  • How do you load google maps as they are not preloaded

    how do you load google maps as they are not preloaded and it would take long time by moving around on the maps

    You can't. The built in Maps app does not store data locally on your phone. It requires a data connection to display location info.

  • How do you set up to back up iPad notes in iCloud?  I turned on backing up notes in iCloud settings, and it asked me to create a .me account, which I did, but I don't see my notes anywhere on iCloud, and I never received a password for my .me account.

    How do you set up to back up iPad notes in iCloud?  I turned on backing up notes in iCloud settings, and it asked me to create a .me account, which I did, but I don't see my notes anywhere on iCloud, and I never received a password for my .me account.

    You'll find your notes under Mail in iCloud. There's a separate folder on the left that's labeled notes so you can access them anywhere. And your me.com account will have the same password as your Apple ID (in fact, you can log into iCloud with just your Apple ID, as the two accounts are permanently linked).

  • TS1424 hi all how do you reset your security questions. i can not remember the answers. how do you reset them? i cant buy anything because it keeps coming up

    hi all how do you reset your security questions. i can not remember the answers. how do you reset them? i cant buy anything because it keeps coming up

    If you have a rescue email address (which is not the same thing as an alternate email address) set up on your account then go to https://appleid.apple.com/ and click 'Manage your Apple ID' on the right-hand side of that page and log into your account. Then click on 'Password and Security' on the left-hand side of that page and on the right-hand side you should see an option to send security question reset info to your rescue email address.
    If you don't have a rescue email address (you won't be able to add one until you can answer 2 of your questions) then you won't get the reset option - you will need to contact iTunes Support or Apple to get them reset.
    e.g. you can try contacting iTunes Support : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Account Management , and then 'Forgotten Apple ID security questions'
    or try ringing Apple in your country and ask to talk to the Accounts Security Team : http://support.apple.com/kb/HE57
    When they've been reset (and if you don't already have a rescue email address) you can then use the steps half-way down this page to add a rescue email address for potential future use : http://support.apple.com/kb/HT5312 . Or you could change to 2-step verification : http://support.apple.com/kb/HT5570

  • HT1386 how do you delete Nike+ app. It will not give me the black 'x' to delete it

    how do you delete Nike+ app. It will not give me the black 'x' to delete it

    Instructions
    1
    Tap the "Settings" app on the iPhone home screen.
    2
    Place a finger on the iPhone screen, and then move it up on the screen to scroll down the screen. Scroll down until you see Nike + iPod. Tap "Nike + iPod."
    3
    Tap the "ON/OFF" toggle to the right of Nike + iPod at the top of the screen until "ON" appears with a blue background.
    4
    Press the "Home" button just beneath the iPhone screen. The Nike + iPod app appears on the iPhone home screen or the next available screen with space for an app.
    Read more: http://www.ehow.com/how_8246915_nike-ipod-app-iphone.html#ixzz2dyhWgNLy

  • [solved] Gnome 3.14.2 Modal dialogs not working

    Hi,
    updated today and found out that the modal password prompts in Gnome 3 do not work anymore. Does anybody know anything about this?
    I´m experiencing following behaviour:
    Whenever a gnome modal dialog with an input field appears the dialog will freeze after submitting the data. The only action left to click is the cancel action (or the escape key) which of course also cancels the data submission and also cancels the data submission the process.
    I would love to debug this, unfortunately Google hasn´t provided anything useful yet...
    Last edited by justforgetme (2015-01-10 15:21:58)

    Ok, so apparently the Modal dialog not working was based on gdk-pixbuf2 dhaving wrong caches or something.
    When consulting journalctl about gnome in general I discovered that my system had lost the ability to comprehend the svg format. One ddg query later i was  here again just in another topic viewtopic.php?pid=1491839

  • How to find that a thread is alive or not

    Hi all,
    I've create a thread to make a http request in every 10 second and get a string as the response from the server. Requesting process start on the window open. And also I can dispose the window, so my processing is not stop. That is exactly what I want to do.
    Say after disposing the window I open it again. So the same thread start again while the first one is running. It messup my work. So I think of it. Every window open try to check that thread is alive or not. If alive stop the thread and start is again.
    So I try this simply.
        public boolean ThreadIsAlive(){
            if(processThread.isAlive())
                return true;
            else
                return false;
        }If I found the thread true on the above code, I want to stop it. So I try this.
        public void stop(){
            processThread = null;
        }I think up to now what I have done is ok. Then on the ActionListner I do this.
                    ActionListener actionListener = new ActionListener(){
                        public void actionPerformed(ActionEvent e){
                            if(appProcess.IsThreadAlive()){
                            appProcess.stop();
                            System.out.println("Main Dialog!");
                            java.awt.EventQueue.invokeLater(new Runnable() {
                                public void run() {
                                    MainDialog dialog = new MainDialog(new javax.swing.JFrame(), true);
                                    dialog.setVisible(true);
                    };No compile error. But I got a runtime exception.
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
            at mytrayicon.Processing.IsThreadAlive(Processing.java:82)
            at mytrayicon.PanelRadarMain$3.actionPerformed(PanelRadarMain.java:73)
            at java.awt.TrayIcon.processActionEvent(TrayIcon.java:750)
            at java.awt.TrayIcon.processEvent(TrayIcon.java:708)
            at java.awt.TrayIcon.dispatchEvent(TrayIcon.java:690)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:604)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)Can anybody help me to solve this.
    Thanks

    ItsJava wrote:
    Hi all,
    I've create a thread to make a http request in every 10 second and get a string as the response from the server. Requesting process start on the window open. And also I can dispose the window, so my processing is not stop. That is exactly what I want to do.
    Say after disposing the window I open it again. So the same thread start again while the first one is running. It messup my work. So I think of it. Every window open try to check that thread is alive or not. If alive stop the thread and start is again.
    So I try this simply.
    public boolean ThreadIsAlive(){
    if(processThread.isAlive())
    return true;
    else
    return false;
    }If I found the thread true on the above code, I want to stop it. So I try this.
    public void stop(){
    processThread = null;
    That does not "stop" the thread, it simply removes that reference to it.
    >
    I think up to now what I have done is ok. Then on the ActionListner I do this.
    ActionListener actionListener = new ActionListener(){
    public void actionPerformed(ActionEvent e){
    if(appProcess.IsThreadAlive()){
    appProcess.stop();
    System.out.println("Main Dialog!");
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    MainDialog dialog = new MainDialog(new javax.swing.JFrame(), true);
    dialog.setVisible(true);
    };No compile error. But I got a runtime exception.
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at mytrayicon.Processing.IsThreadAlive(Processing.java:82)
    at mytrayicon.PanelRadarMain$3.actionPerformed(PanelRadarMain.java:73)
    at java.awt.TrayIcon.processActionEvent(TrayIcon.java:750)
    at java.awt.TrayIcon.processEvent(TrayIcon.java:708)
    at java.awt.TrayIcon.dispatchEvent(TrayIcon.java:690)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:604)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
    I'm sorry, but you set a reference to null, then attempt to derference it, and you wonder why you get an NPE?
    >
    Can anybody help me to solve this.
    ThanksTo stop the thread, have a volatile variable that you can change the value of using a synchronized method, and have the thread
    periodically check the value of this variable and stop itself when the value equals a specific value. That is one way to properly
    stop the thread.

  • In iTunes, podcasts are sorted in the library alphabetically. In Version 1.2.1, there is no order and there are duplicates.  Can you sort the library? and how do you remove duplicates of the same podcast (not episode)?

    In iTunes podcasts were sorted in the library alphabetically.  In Version 1.2.1, there is no ability to sort and podcasts (not episodes) are duplicated.  Can you sort the Podcasts in the library section? How do you remove or consolidate duplicates?

    In iTunes podcasts were sorted in the library alphabetically.  In Version 1.2.1, there is no ability to sort and podcasts (not episodes) are duplicated.  Can you sort the Podcasts in the library section? How do you remove or consolidate duplicates?

  • How do you make a photo an attachment and not in the body of the email

    How do you attach a photo as an attachment and not in the body of the email?

    If you attached the photo using the attach icon or attach command, it will act as an attachment on the recipient's end, even though you see it in Mail in the body of your message. If you drag and dropped your photo into your email, it will act as a placed graphic in the body of your message.

Maybe you are looking for

  • How do I hide the display of empty dynamic fields in a PHP query

    I need help, I've spent the whole day on this, and I'm not getting any further. I am creating a simple blog, where articles can be added via a form in dreamweaver that uploads data to a mysql database. I have the following fields in the database: "ti

  • Help viewing shared calendars on my iPhone?

    I've seen this same issue in a couple forums but haven't seen a solution yet. Maybe I'm just missing something. I am running outlook 2007, exchange 2003. All of my appointments in my calendar sync nicely between outlook and iphone but we have a share

  • WLST - Failing to run nmConnect() command / node manager becomes unreachabl

    Hello guys, I'm facing some issues to setup some configurations of one application that I've deployed on weblogic 10.3.3.0. One of the needed steps in order to configure this applications is open the WLST in offline mode an run 2 commands: */bea/mytr

  • Missing photos and NONE of my recent camera downloads stay

    I have been browsing the forums and it seems there isn't a solution for this but I will still post it anyway. I just tried to download the latest photos of my daughter into iphoto, it came in ok so I told it to delete the photos off of the camera. On

  • Form File field --help

    I have an upload page and action...when I submitted to the action page it uploads a file to server then read the excel file then check the db if column data already exists in db it display a msg so when one clicks "append the data to the exsting db",