Waiting for Displayable to come out

Well, here's the thing: I have a custom Canvas that receives some input from the user.
There's a function that, when called, sets this Canvas as the current in the Display and returns whatever the user has entered. I would like for that function to wait until the user has ok'ed or cancelled, that is, to wait until the Canvas is no longer the current.
Hard as I tried, I couldn't stop execution at that point. Perhaps I should make the Canvas a thread (Runnable), or run in one?
Thanks in advance.

k_i_shor is right. I just wanted to create a reusable function that only returns after the user has entered. I understand that deepspace's approach is also possible (I don't see the advantage, though).
As requested, a piece of the code (the first try with wait() and notify()):
public class PasswordScreen implements CommandListener {
  /* some things */
  public static String requestPassword(int numdigits, Display display) {
    PasswordScreen ps = new PasswordScreen(numdigits, display);
    try {
      ps.activate();
      ps.wait();
    } catch (Exception e) {
      return null;
    return ps.getPassword();
  //voila, the constructor
  public PasswordScreen(int numdig, Display display) {
    this.display = display;
    this.typed = 0;
    this.numdigits = numdig;
    chars = new char[numdigits];
    canvas = new Canvas() {
      public void paint(Graphics g) {
        /* doesn't really matter */
    canvas.addCommand(okCommand);
    canvas.addCommand(cancelCommand);
    canvas.setCommandListener(this);
  public void activate() {
    last = display.getCurrent();
    display.setCurrent(canvas);
  public String getPassword() {
    if (typed == 0) return null;
    else return new String(chars, 0, typed);
  public void commandAction(Command command, Displayable displayable) {
    //just an example:
    if (command == okCommand) {     
      this.notify();
  }No matter if I use synchronized in the commandAction or anything it calls.... In fact, the real problem seems to be that the wait() call locks the main thread execution and therefore any further processing (as I'm not using any other threads).
Thanks for the support.

Similar Messages

  • Should I buy iLife09 at this time or should I wait for iLife10 to come out?

    Is iLife10 coming out any time soon? What about iWork10?

    Welcome to the Apple Discussions. As Terence pointed out we don't know if there is going to be an iLife 10 or if so, how soon. However, in the past the new iLife versions were usually released during the MacWorld Expo in San Francisco. Apple is not participating in it to the extend they have in the past so it's anyones guess if and when that's when they will release a new version. If you can live with the version you currently have until the end of February on the off chance that a new version will be released then wait.
    Don't know about iWork.
    OR, you could by a new computer which comes with iLife and if a new version is released by the end of February you can get the new version for a mailing fee.

  • Broken 2G iPhone.. wait for 3G to come out?

    My 2G iPhone was the victim of some water damage about a month ago, the only thing wrong with the phone is that the home screen button does not work, so in order to get from the calendar to the home screen, I have to turn the phone off, I have found some shortcuts between the phone and texting, but it is annoying to have to turn off several times a day, also my computer does not recognize my iPhone any longer. I was waiting to come home from college and recieve my first pay check before paying the $250 for a refurb. Since I have been living this long with a damaged phone, should I just wait it out until July in order to get the 3G model for $199 instead of paying $250 for the refurb? Will this even work? I know my contract will just be extended, but that is fine with me. Let me know what you think. Thanks

    Hi!
    First of all, do you live in an area with 3G signal? is GPS important to you? noone can answer this for you. compare the specs and decide what you need.
    Good luck, and if you have any other questions make sure to let us know!

  • Error while invoking bean "delivery": Waiting for response has timed out.

    Hello,
    I am running a process that currently catches an exception from a partnerlink. When the exception is caught I send an email and the process exits. When I submit a request from the BPEL console, I have to wait until the JTA timeout before the page returns. However, the instance completes successfully and I receive the email before the timeout happens. This is what I see in the logs. When I look at the audit and activity flow, all of the activities were timestamped prior to the exception being thrown. Has anyone seen this behavior or know what is going on. Is there a problem sending email in a catch or catchAll block?
    <2009-04-19 22:33:41,859> <ERROR> <iCareTest.collaxa.cube> <BaseCubeSessionBean::logError> Error while invoking bean "delivery": Waiting for response has timed out. The conversation id is cf9324c9be114336:513ede58:120c17e1922:-7fc0. Please check the process instance for detail.
    com.oracle.bpel.client.delivery.ReceiveTimeOutException: Waiting for response has timed out. The conversation id is cf9324c9be114336:513ede58:120c17e1922:-7fc0. Please check the process instance for detail.
    Thanks in advance
    Jim

    There is no issue the reason why it times out is because you don't have a reply back to the client in your catch all.
    If you look at your process you will see that the defaul reply is in the main scope. When the catch all is invoked this reply is by passed, therefore no reply is sent.
    PLease a reply in your catch all back to the client and it will work.
    cheers
    James

  • Waiting for response has timed out and Bad response: 401 Access denied

    Hi,
    I am using a partner link to invoke a wsdl.This wsdl I am downloading from server after giving the username and password details.
    So while invoking it i m providing the credentials details in bpel.xml file .
    <property name="httpBasicHeaders">
    <property name="httpBasicUsername">
    <property name="httpBasicPassword">
    After providing this details also I am getting error .
    <faultstring>com.oracle.bpel.client.delivery.ReceiveTimeOutException: Waiting for response has timed out. The conversation id is 11d1def534ea1be0:-3d858514:1209f42a251:-7da8. Please check the process instance for detail.</faultstring>
    </Fault>
    On cheking to audit instance i m getting the below error:
    exception on JaxRpc invoke: HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Bad response: 401 Access denied
    Plz help me out asap.
    Thnaks

    can you please post you bpel.xml file the setting for basic authentication should be as follows. It is unclear if this is how you have it or you posted a subset of the bpel.xml.
    <property name="httpBasicHeaders">credentials</property>
    <property name="httpBasicUsername">your_username</property>
    <property name="httpBasicPassword">your_password</property>
    looking at the error it looks like you have given the wrong credentials.
    cheers
    James

  • When Will THE update for the ios7 come out for the ipod touch 5 gen

    When Will THE update for the ios7 come out for the ipod touch 5 gen

    Forum Tip: Since you're new here, you've probably not discovered the Search feature available on every Communities page, but next time, it might save you time (and everyone else from having to answer the same question multiple times) if you search a couple of ways for a topic, both in the relevant forums and in the Apple Knowledge Base before you post a question.
    Regards.

  • Waiting for sequencer to come up (Rosegarden)

    I really want to get rosegarden working, so I can start producing and such.  But I'm having some errors.  First I get an error message box telling me that Sequencer could not be started so sound and recording is unavailable.  If I look at the standard output in the terminal window I see something like this:
    JackDriver::initialiseAudio - JACK server not running
    ALSA lib seq_hw.c:455:(snd_seq_hw_open) open /dev/snd/seq failed: No such file o r directory
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    rosegarden: RosegardenGUIDoc::syncDevices - waiting for Sequencer to come up
    Any Ideas?

    try:  modprobe snd-seq-oss

  • Where can I find a waterproof, shockproof, dustproof, dirtproof etc case for my Ipad Air very soon and not have to wait for the perfect case for months to come out from Lifeproof company???

    Hello,
    I just bought a new Ipad Air 128gb w/verizon coverage. I definitely need a all proof case for it like the Lifeproof case I already have for my Ipad 4 w/retina display.  Unfortunately I'm hearing Lifeproof hasnt come out with the Air case yet.  Can anyone help me locate a company similar that will have that sort of case pls.  thanks.

    I know  Targus has one called Safeport with 3 levels of 'strong, stronger, strongest' but I couldn't find it specifically saying it accommodated the Air on their site. BUt it could be another brand for you to search for.

  • Waiting for SP1 to come through Windows Vista Update?

    Hi:
    I have been waiting for SP1 to make an appearance through Windows Update and am still waiting. I checked out the knowledge base and checked all the problem drivers to see if I had any of the components.
    I don't have any of them, nor do I have any hidden updates that I have opted not to install. Is there anything else I could possibly check? I checked all my drivers in device manager and all are updated.
    Thanks!

    Hello Lisa
    I know it sounds now stupid but what is your problem? Maybe I understand English not so good but I didnt find any concrete question. I understand that you are waiting for SP1 and what now?
    To be honest you should not install SP1 at the moment. At the moment SP1 is not supported by Toshiba and if you will have some problems nobody can help you. SP1 stuff can (muss not) have some negative influence on different drivers or tools. Toshiba will fix this and offer updates but just when SP1 is official supported.
    If you have all latest drivers it is enough. Leave it as it is.

  • HT201401 I am so frustrated!!!! My iphone 4s will no longer show caller id when a call is waiting, and it won't answer the call either.  I need to disconnect from first call and wait for call to come through without knowing id.  Help!!! I see no solutions

    My iphone 4s will not answer call waiting.  When I go into settings there does not appear to be the option to enable call waiting, yet I have had it for a year and had no problem with it!  Caller id does not show up during an existing call and the call waiting cannot be ansered.  Can anyone help???

    My iphone 4s will not answer call waiting.  When I go into settings there does not appear to be the option to enable call waiting, yet I have had it for a year and had no problem with it!  Caller id does not show up during an existing call and the call waiting cannot be ansered.  Can anyone help???

  • Hi, my phone was stolen a few days ago and I was waiting for it to come online to track the last known location where it was turned on. Now that my phone has been locked but i cant seem to find the last location it was online. I need the last location

    Hi, my phone was stolen a few days ago and just a few days ago the phone was online and it automatically locked itself since I've put it under lost mode and the thief probably switched off the phone immediately so that I cant locate it. Is it possible for me to have the last known location where he/she turned on the phone so that I can track it down from the last location? Thank you

    Correct.
    The only way to locate/disable/erase any lost/stolen iPhone/iPod Touch is through Find My Phone or a similar app. However, this requires that Find My Phone be setup/activated, on your phone, before it was lost/stolen. You would then login at iCloud.com & try to locate it. This requires the phone be turned on & have an Internet connection. There is no other way to locate a lost/stolen iPhone. Apple can't/won't help you, nor will your carrier. Report the loss to the Police, your carrier & Insurance company. Change all of your passwords.
    If your carrier offers Blacklisting & they Blacklist the phone, it will be unusable as a phone.
    If locked with a passcode, and running iOS 7.0, then phone cannot be activated or the passcode removed without knowing your Apple iD/Password. It will be nothing but a useless paperweight.
    If not running iOS 7.0, the phone can be forced into recovery mode & restored.

  • So is there any news on when Desktop Manager for Mac will come out? - Only 2 days left in September

    Could we maybe get an update from RIM here?  We have two days left in September but still nothing but rumors when it comes to when the desktop software will actually be released....Yes I know there is another thread asking the same question, but it seems that has gone off on other tangents...
    Message Edited by errandwolfe on 09-28-2009 04:47 PM

    No one knows.
    The former answer of September seems still within reason... otherwise.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • URL for running forms9i comes out wrong

    Hi!
    When trying to run a form from my Forms9i Builder the URL that is used looks like this:
    http://%%20"http://mojo.intern.sti.no:8888/forms90/f90servlet?form=C:\MortenJ\....... and so on.
    This page is not found, because of the first part of the URL: http://%%20"
    When I remove this string, the form runs fine.
    Why does forms come up with this URL? Any ideas on how to avoid it?
    Regards
    Morten

    From the menus go to preferences runtime and change it there.

  • HT4623 I received update to iOS 7.0.2 for iPad mini. Click download and install, wait for ever then comes an error, what can I do?

    Can't update to iOS 7.0.2 for iPad mini, it goes for ever, then error.
    Please, help!

    Don't install it. I just upgraded on my ipad and my orientation is now screwed. My screen keeps flipping around and it's annoying!

  • Firefox does not deal with australian currency accurately. For example $5000 comes out as AUD 4850 or something similar

    I have copied these SAME account lines from the 2 browsers
    Internet Explorer VIEW OF THIS TRANSACTION<br />
    Practice Account
    BSB 112-879 Acc 028 725 xxx $179.41 Available balance: $179.41
    FIREFOX VIEW
    Practice Account
    BSB 112-879 Acc 028 725 xxx AUD172 Available balance: AUD172

    You're welcome

Maybe you are looking for

  • How do I add buttons to specific spots on a panel?

    Hi, I currently have a 500 * 500 image which is the background of a JPanel (So I suppose I have a 500 * 500 JPanel, basically). I would like to be able to place (20*20) buttons on various places of this image - for instance, add button1 at position (

  • Error while doing file to mail scenario

    Hai All,           I am getting the following errors while doing the file to mail scenario. Error:Exception caught by adapter framework: Failed to call the endpoint Error:Delivery of the message to the application using connection AFW failed, due to:

  • Viewing and Printing Acrobat 3D Files

    I'm an Adobe consultant and trainer, and I have a couple questions about Acrobat 3D. Most print service providers are not going to have copies of Acrobat 3D. If 3D objects are created or imported into Acrobat 3D, can it be opened and viewed in Acroba

  • Dequeue sessions still active

    we have an application server(proc) that dequeues messages. If the application server stops or is killed the database session still remains active.(in v$session) Is there something that I missed in order to free up these sessions.

  • Cannot execute sapevt.exe on a Windows platform

    Hi for some reason I cannot get the sapevt.exe program to raise an event in SAP when running on a Windows platform. The command line I'm using is : D:\usr\sap\<SID>\SYS\exe\uc\NTAMD64\sapevt.exe event=EVENT_NAME -t2 name=<SID> pf=D:\usr\sap\<SID>\SYS