JOptionPane Closing Question

I am trying to close a dialog window when a boolean variable in another class changes to false. I use JOptionPane inside of an instance of Dialog. I have tried using hide(), dispose(), and setVisible(false). The problem is that the dialog window does not know to check the variable. Do I need to add some kind of event listener or what? I know this isn't compilable but I think this is a simple question, I must just be overlooking something...
      Object[] options = {"Stop"};         
         JOptionPane optionPane = new JOptionPane("Playing...",          
              JOptionPane.OK_OPTION,
           JOptionPane.INFORMATION_MESSAGE,
           dialogIcon,     //don't use a custom Icon
           options,  //the titles of buttons
           options[0]); //default button title
         Dialog playingDialog = optionPane.createDialog(frame, "Status");
         playingDialog.setVisible(true);
         //here is what needs to happen when the orhb class sets getPlayState to false
         if(!orhb.getPlayState()){
           System.out.println("done playing, close window");
           setVisible(false);
         }

Here is the code that provoked my answer, above:Yea, I thought the same thing at first but then I when I re-read it, I realized that the OP was saying this code:
//here is what needs to happen when the orhb
class sets getPlayState to false
if(!orhb.getPlayState()){
System.out.println("done playing, close window");
setVisible(false); is not being called and the question was where to put it. (Of course once he determines where to put that code he will have to call it on the appropriate object)

Similar Messages

  • Month end closing question from a DBA

    Hi all,
    I am a DBA not a functional setup person/Business Analyst; so excuse me if my question is not put in business terms.
    We have an 11.5.10.2 that operates in US, Canada, Peru, China and Australia. Each of these have their own Set of Books. When the time comes to do month end closing, our finance people tell all incl our US and other countries branches to stop the following transactions on the system while month end closing is going on:
    •     Inventory
    o     Pick, pack and ship for SO’s and Internal Req’s
    o     Receiving of PO’s, Internal Req’s and OSP
    o     Subinventory transfers
    o     Consignment consumption
    o     Inventory adjustments
    •     WIP
    o     WIP moves and completions
    •     Accounts Receivable
    o     Cash applications
    o     Invoicing of any shipping activity past cutoff o     Manual invoices and credits
    •     Accounts Payable
    o     Invoice entry and cancellation
    o     Manual or batch payment runs
    Question that I have is: how can month end closing be done where each of these countries could freeze these activities for their last day of month when last day of month starts obviously earlier in Australia and China compared to US, Canada and Peru? As of now, they all seem to follow the last day of the month procedure as the US. It takes about 7 hours for the whole process to run.
    All comments/suggestions welcome.
    Thanks,
    Edited by: DBA115102 on Mar 4, 2011 7:14 PM

    Hello.
    SQL> select p.period_name, ae.event_status_code, p.closing_status, h.AE_HEADER_ID
    2 from ap_ae_headers_all h, ap_accounting_events_all ae, gl_period_statuses p
    3 where ae.accounting_event_id = h.accounting_event_id
    4 and h.period_name = p.period_name
    5 and p.application_id = 200
    6 and p.closing_status = 'C'
    7 and ae.event_status_code = 'CREATED';
    no rows selected
    SQL>
    As you can see, i cannot find similar situation. My database has data since 1998. Perhaps we are using different APPS versions, mine is 11.5.10.2
    Octavio

  • Basic stream/file/socket closing question

    If you create a stream, it's generally considered good practice to call close() on that stream once you're done with it. the same for files and sockets. My question is what happens if I don't keep a reference to the object that needs closing. For example:
    BufferedInputStream bis = new BufferedInputStream(new FileInputStream(new File("myfile.txt")));Clearly, I can close() bis. But does doing so close the FileInputStream, and the File? OR, will those remain open until the garbage collecter gets around to closing them. If not, is it considered good practice to keep references around for the sole purpose of explicitly closing the resource so you don't have to wait for garbage collection?
    Finally, is it necessary to close() sockets/files/streams prior to calling System.exit()? It would save me a great deal of code in my exception handlers if I could simply exit() without explicitly freeing the resources I've opened prior to hitting the exception.
    Thanks.

    You should only need to call close on bis. That method call should take care of calling close on the underlying stream.

  • AP month-end closing question

    consult :
    if there are records in table 'ap_accounting_events_all' which EVENT_STATUS_CODE = 'CREATED' , will them influence the AP month-end closing ??

    Hello.
    SQL> select p.period_name, ae.event_status_code, p.closing_status, h.AE_HEADER_ID
    2 from ap_ae_headers_all h, ap_accounting_events_all ae, gl_period_statuses p
    3 where ae.accounting_event_id = h.accounting_event_id
    4 and h.period_name = p.period_name
    5 and p.application_id = 200
    6 and p.closing_status = 'C'
    7 and ae.event_status_code = 'CREATED';
    no rows selected
    SQL>
    As you can see, i cannot find similar situation. My database has data since 1998. Perhaps we are using different APPS versions, mine is 11.5.10.2
    Octavio

  • POPUP closing question

    Good morning experts
    I have searched the thread through on this and have attempted many things. I have a "super" page in my application that displays a record and all of its m:m relationship details. Also, I have a series of buttons on this page that call popup windows that will allow a user to enter data on a specific detail section (comment, child, etc). Once they have entered the data and pressed the "Create" button on the popup, the popup window is redirected to another page that does nothing but close the popup. My problem is that once the popup window is closed, I want to automatically refresh the super page so the data they just entered is displayed.
    Any ideas on how to do this?
    Thanks in advance
    PamH
    Edited by: Pam H on Feb 5, 2010 8:00 AM

    To refresh parent page create a page process.
    htp.p('<script>');
    htp.p('window.opener.location.reload(true);');
    htp.p('</script>');There is no need to branch to other page to close the popup. You can close poup by inbuilt popup porcess.
    Create a process and select Close Popup process.
    After creating close popup make sure branches associated with the button is removed.. else it will result in error.
    Regards,
    Shijesh
    Edited by: Apex_Noob on Feb 16, 2010 4:01 PM

  • JOptionPane input question

    Hi everybody,
    I have JOptionPane input dialog in a program to input file names, and I have a lot of text files to input, over 20. They all come from the same folder, the only difference is their names. Does anyone know, is there a way to have the JOptionPane show the last thing I inputted when it comes up again, so I don't have to type the whole file name again. For example (this isn't exactly code, but I'm formatting it that way so it's clear):
    String fileMined = the result from the JOptionPane input dialog
    fileMined is saved and used to create a button
    If the user wants more input the JOptionPane comes up again
    Show the previous fileMined, but let the user change part of it
    Save the new string as fileMinedJust to make sure I'm clear, it would be something like:
    Type in C:\Text.txt in JOptionPane
    Next time JOptionPane comes up, C:\Text.txt is in the input field, and we can just delete "Text" and replace it with whatever other file name we need
    If anyone can tell me how to do this, I'd be very grateful!
    Thanks,
    Jezzica85
    Message was edited by:
    jezzica85

    Thank you Michael, I didn't know there was something with that few parameters. My code still isn't working to put the previous string in the input box, I have a feeling I'm doing something small and silly. So far, I have:
    Object inputString = new String( "" );
                 fileMined = JOptionPane.showInputDialog( "Input File", ( String )inputString );
                 if( ( fileMined != null ) && ( fileMined != "" ) ) {
                      inputString = fileMined;
                 }So once again, I guess, can you tell what I'm doing wrong?
    Thanks again,
    Jezzica85

  • Simple JOptionPane.showOptionDialog() question

    Could you please help me:
    Here's a piece of code:
    JPasswordField field = new JPasswordField();
    int choice = JOptionPane.showOptionDialog(null, field, "Enter password:", 0,
    JOptionPane.QUESTION_MESSAGE, null,
    new String[] {"&#1054;&#1050;", "Cancel"}
    , null);
    How to make an enter-key-press on JPasswordField to be equivalent to pressing OK key?? If it's possible or i should use bigger constructions (like private class PasswordAskClass extends JDialog) ???
    Thanks in advance for your replies.

    The problem is that you don't have a reference to the OK button.
    1) use a JDialog like you suggest.
    2) Create the buttons yourself, and pass them into JOptionPane as arguments.
    Then you'll be able to add a KeyMap to your JPasswordField that when ENTER is pressed, it sends an action event to your OK button.

  • JOptionPane.showInternalOptionDialog Question

    I'm using the JOptionPane to show an internal dialog. Is there a way such that I can bind the function keys to the options? For instance, my options are "OK", "Cancel" but I want to bind the F3 key to "OK" and the F12 key to "Cancel".
    Thanks

    You have to write your own JDialog/JInternalFrame - if you like, you can use JOptionPane's createDialog(...) or createInternalFrame(...) methods. Then attach a keyListener for example.

  • JOptionPane closing issue

    I have an application where 2 threads display the JOptionPane simultaneously. i'm not able to close the JOptionPane on the top by clicking on the OK button. Have someone come across this prb & know the solution ? if so pls let me know..

    Swing is not thread safe and for that reason all Swing actions should be handled via the SwingEventQueue.
    Therefore you external threads should take care of showing the option pane by placing calls onto the swing event queue via SwingUtitlities.invokeLater and SwingUtitlities.invokeNow.
    Post your code and we will try to solve your problem
    nes

  • Lid closing question.

    I am an Apple newbie. I have a mid 2014 MacBook Pro that I just bought a few weeks ago and would like to know how to change actions when closing the lid. Is it possible to have the laptop blank the screen and lock as opposed to going to sleep when you close the lid? I can't find a setting for this anywhere. If I'm playing music over my bluetooth speaker and want to leave the room and close the lid, the laptop goes to sleep even when plugged in. The only settings I see are under "System Preferences - Energy Saver" but nothing there allows me to just blank the screen when closed.
    Any help with this would be appreciated. Thanks
    MacBook Pro 15" Retina (mid 2014)
    OS X 10.10.1

    Formally this is not possible. But there's an app for that.
    http://semaja2.net/projects/insomniaxinfo/

  • Remote Desktop - Cmd+D - save without closing question

    I'm trying to write a script that will allow me to quit an application (SketchBookExpress) without saving changes.  I'm having trouble with the syntax for the "Don't Save" (cmd+d).  The script runs but stops at the on screen Save/Canel/Don't Save dialog box. 
    What I have tried is the following:
    osascript -e 'tell application "SketchBookExpress" to activate';
    osascript -e 'tell application "SketchBookExpress" to quit';
    osascript -e 'tell application "System Events" to delay 0.5';
    osascript -e 'tell application "System Events" to keystroke "d" using {command down}';
    And I've tried:
    osascript -e 'tell application "SketchBookExpress" to quit';
    osascript -e 'tell application "System Events" to delay 0.5';
    osascript -e 'tell application "System Events" to key down command';
    osascript -e 'tell application "System Events" to keystroke "d"';
    And, I've also tried:
    osascript -e 'tell application "SketchBookExpress" to quit';
    osascript -e 'tell application "System Events" to delay 0.5';
    osascript -e 'tell application "System Events" to to keystroke "d" using {command}';
    I'm very new to Remote Desktop and AppleScript and would appreciate any help you can provide about how to close an app without saving it.
    Thanks.

    I think you need to turn this on its head.
    SketchBook Express is not scriptable, so you can't use the 'normal' method, which would be:
    tell application "SketchBook Express" to quit saving no
    The problem with your approach is that AppleScript is serial - each command is executed in turn, so it's waiting for the app to quit before executing the next command (unless you run all these commands in parallel, but that's a different issue.
    However, there's a simpler solution to your problem:
    killall SketchBookExpress
    This sends the Kill command to the app, quitting it, bypassing the whole 'Save changes?' process.
    This is a standard shell command, so you don't need AppleScript (or osascript) to run it. If you do want to wrap this in a larger script, just use 'do shell script':
    do shell script "killall SketchBookExpress"

  • Laptop opening and closing question.??

    Hi,
    When I open and close my laptop the screen housing seems too tight. It will make a pop sound when I start to close it. Or if I adjust the screen to fit an angle Im sitting at it will make that pop sound. Is there some kind of adjustment/tention or something. I dont want it to keep doing it and break something in the hinge area. I just bought it in January new. Thanks!

    Post this on the hardware forum for your laptop model since this forum really is for software that can be run on many different model Macs and is not the best place to ask about hardware of one model.
    Since it is new my inclination would be to take it back to the store and ask them about it.

  • IBook top part (screen) closing question

    Hi,
    Like to ask if is there any bad just close the top of the computer, wait until the white "lamp" lighting and move away only after?
    Can it make any demmage to the HD?
    Thanks in advance.
    laci

    Hi laci,
    When the iBook sleeps, it goes into a low power mode and the hard drive stops. What you describe is what I almost always do. I rarely shut it down.
    John

  • Multiple Chart Types Question

    I have a chart with 4 data series.  The 1st 3 are column and the 4th is line.  The line is removed on the 4th series to show up as a data point.
         The data point for the 4th series shows up as in the middle of the 3 other series so it looks like the data point is related to the 2nd series.  I'm curious what controls this behavior?  Any way to shift it so it appears over the 1st series?
    Thanks!

    Closing Question
    Assigning Points

  • I know this is a common question - but is there a way to connect a USB pen drive to the iPad? (See details)

    Basically, I just bought a Nexus 7 after growing impatient waiting for the iPad mini.  But the Nexus has a fault, and I'm taking it back next week.  I'm wondering whether to get my money back, or just get another - because it's a pretty good device!
    My major big thing about it, is that I can plug a USB pen drive into it with a OTG cable and either just stream pictures, documents or movies - or save them to the Nexus for viewing without a dangly wire to annoy me.  It's great!  However, being an Apple fan - an iPad mini (if it comes out!) would be simpler, because it would sync to iCloud etc.  whereas obviously my Nexus 7 doesn't do this at all.  The only iCloud factor I can access is my mail.  Which isn't a problem, just a prefference.
    So, with current iPads - is there a way, without jailbraking the device, to say stream movies to the device through a USB pen drive/external HDD, and save them to the iPad?
    I've seen ways on YouTube but thought it was best to ask here.
    If this was possible, I'd swap the Nexus for the iPad mini straight away - the Nexus 7 is fantastic!  No problem with it, if it wasn't for iCloud, I'd keep that.
    Oh, and as a closing question on the iPad mini/Apple Maps - the Nexus 7 lets you download offline maps, and also you have a GPS which is used even when not on wifi - do you think this will be likely on an iPad mini? I can't see it myself.
    It's a sad day for me, when I start to think Google may still have the upperhand on 7" tablets, even after the iPad mini is released.  I might even wait for the Second generation (if it exists!) - just because I for some reason never like first generation things from Apple.
    But anyway, that's a lot of questions and info!
    Thanks in advance!

    jrburrows wrote:
    Ok, fair enough.  But since Job's death - Apple's control on leaks has been terrible.  I got the new iPhone, and I like it - but it hasn't made nearly as big as an impression as previous ones.  Because of the vast ammount of leaks.  With the iPad mini leaks, it's 99% sure to come out next week.
    Apple uses many manufacturers and it's massive also websites prefer to report on Apple whether true or false because it brings more hits.
    Amd by "others" I meant other people on iPads - not other devices/manufacturers.  It's possible to do so, I just want to know how.  I honestly don't think we'll ever be in a Post-PC era until all tablets allow us to use USB in the way computers do.
    No, USB is not the future, you missed the memo about cloud and wireless computing?

Maybe you are looking for

  • Problem with itunes and ipod

    well i have my ipod nano i believe and i tried upgrading to the new itunes. when i did i get an error saying the ipod communications program is not working. when i try to plug my ipod in itunes does not recognize it at all. and i cannot get my music

  • Dashes in JSP File Names

              Has anyone seen this problem before?           I have a WAR application deployed to WebLogic Server 6.0 including several JSP           files. The construction of the WAR file and all of the JSP pages is correct.           However, if any o

  • Powerbook G4 1.67GHz 15 inch HR DC board failure?

    Hi, I am unsure if anyone experience the same thing and I am hoping someone can confirm my conclusion on replacing my DC board. My powerbook failed on Saturday morning when it was left running overnight for some work. When I woke up in the morning, i

  • Elements 13 serial number not accepted

    Purchased, downloaded and installed Photoshop Elements 13 on Mac. After installation it asks for serial number. It will not accept the serial number from the purchase email. I verified it was the same serial number as on the accounts page. I checked

  • Anti-virus for SL??

    Just curious..... which is the best free anti-virus to be used with SL? I previously had ClamXav, but the beta version for SL seems to be buggy and unresponsive. So, hadn't installed it yet.