Help on invokelater and invokeandwait

Hello,
i am developing an application using swing API.
in this application i have to read ceratin data from the database. and do operation on the data.
what i want to do is to fetch data based on a query and display the data to the user in a JTable on a separate JFrame. the user selects the row from the table, he wants to process and presses the select button on this frame, to set the static variable (say ROW_ID) in the class whcih invoked this frame.
now what should happen is that the invoking class object should wait untill i press the select button (ie when the ROW_ID is set).
i would like to know how to do it.
please help
thank you
Message was edited by:
vaibhavpingle

now what should happen is that the invoking class object should wait untill i press the select button (ie when the ROW_ID is set).
It doesn't sound like you want invokeLater() or invokeAndWait().
I think you want one of two things: the more likely is that you want to be using a modal JDialog to allow the user to select a row (if you display the table, make the selection and then close that new window). The other possibility is that you want your original object to have state, which is modified (on the Event Dispatch Thread) when the user makes the row selection. Until that state is modified, certain functionality is disabled.
i also tried to use the invokeAndWait(runnable) method but i got an exception saying that the call cannot be made
What exception? I don't know of one which says "the call cannot be made."

Similar Messages

  • InvokeLater() and invokeAndWait(): concerns over synchronization

    I've been reading up on the methods invokeLater(Runnable) and invokeAndWait(Runnable) and I've understood this much: the difference is in the synchronization of the new thread with the main (or current) one. I somewhat familiar with what synchronization means (i.e. it's a way of guaranteeing that changes made to shared resources are seen by all threads as soon as they are made).
    My question is: does a call to invokeAndWait() mean that I don't have to worry about synchronizing methods and code?

    gib65 wrote:
    My question is: does a call to invokeAndWait() mean that I don't have to worry about synchronizing methods and code?No. Both the invoke methods just push off code to be executed in the event thread. That might mean that you don't need synchronization, but only if the synchronization was needed because you had the event thread and another thread accessing same resources.
    The difference is that invokeLater doesn't stop the execution of the current thread, while invokeAndWait stops the current thread until the task has been run on the event thread.

  • InvokeLater() and invokeAndWait()

    I'm somewhat confused about when to use these.
    from http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html - it says "you must take extreme care that Swing components and models are created, modified, and queried only from the event-dispatching thread"
    I also understand that these two methods are basically the same though invokeAndWait only returns once the run() has completed while invokeLater will return immediately.
    So, when should I use these? and which one should I use?
    If I'm creating the GUI initially, use the invokeAndWait()
    If I'm updating/quering the GUI components, use invokeLater()
    is this the correct way of thinking?

    You only need to use these methods if you are updating your GUI from a Thread you have spawned. These methods insure the GUI udpate is performed from the event dispatcher thread as those methods put the GUI update in the event queue.
    If you are already updating the GUI from the event dispatcher thread (i.e. from an ActionListener, MouseListener, etc) you don't need to use them.
    For instance lets say you do an expensive database query (takes a noticeable amount of time to return results) when you press a button. If you just do the database query in the main thread the rest of your application will block while the db query is performed. So you would spawn a new thread with your db query in it. However, now lets say when the db query is over you want to update some status label to notify the user. You would put the label update in a Runnable object and pass that to invokeLater() which would put your runnable oject in the event queue which would eventually get executed by the event dispatcher thread.
    Now the rest of your application is responsive while the db query is occuring. And the label will be updated in a thread safe way when the db query is done.
    Generally invokeLater() is used, as invokeAndWait() blocks until the runnable object you add to the event queue is executed. This isn't generally desireable. More or less you can safely ignore invokeAndWait(), although keep it in mind for those rare occasions where its usage would be desireable.
    Here a very generic example:
    public void actionPerformed(ActionEvent e) {
          //Button has been pressed lets query the db in a thread
          new Thread() {
                public void run() {
                    //Hit the DB
                    Runnable changeLabel = new Runnable() {
                        public void run() {
                            label.setText("tell user db query is done");
                    //Put the changing of the label in the event queue
                    EventQueue.invokeLater(changeLabel);
            }.start();
    }

  • I need help to find and open a job app that I exported, was able to fill out and sign and saved and now can't open it? What did I do wrong?

    I need help to find and open a job app that I exported, was able to fill out and sign and saved and now can't open it? What did I do wrong?

    What file format did you export it to?

  • HT4623 please help - installed IOS7 and now I am having problems playing Words Free on my Iphone.  It gives me a pop up telling me to connect to ITunes but will not connect.  Cannot get out and have to continually shut down my phone and start over.

    please help - installed IOS7 and now I am having problems playing Words Free on my Iphone.  It gives me a pop up telling me to connect to ITunes but will not connect.  Cannot get out and have to continually shut down my phone and start over.

    Hi, jeantwin.
    Thank you for visiting Apple Support Communities.
    The steps in the article below may help you resolve the issue with push notifications.
    iPad and iPod touch: Unable to use YouTube or Push notifications
    http://support.apple.com/kb/ts3305
    If the issue persists, try signing out of your Apple ID and then sign back in.
    iOS: Changing the signed-in iTunes Store Apple ID account
    http://support.apple.com/kb/HT1311
    Cheers,
    Jason H.

  • Does any update help to install and run myFaces components?

    Hi.
    I have JSC trial. And didn't make update.
    I can't install myFaces component library. Why?
    Does any update help to install and run myFaces components, and other component library?
    Thanks.

    Hi,
    The following thread could be of help for you:
    http://swforum.sun.com/jive/thread.jspa?forumID=123&threadID=48666
    Cheers :-)
    Creator Team

  • Need help to import and syncronize HCM pagelets with Interaction Hub, how can I do that?

    Hi,
    I need help to import and synchronize HCM pagelets with Interaction Hub, how can I do that? The default page "Select Remote Content" of the WorkCenter "Unified Navigation WorkCenter" is not working as well, when I run the import/sync button I get the following error message:
    Integration Gateway: General Connection Failed (158,10836)
    This error is thrown when there is no valid response.
    Possible errors include:
    Bad gateway URL
    Sync Service Timeout set and Service actually timed out.
    Java exception thrown - Check Application Server for possible Java exception

    Do you have integration configured between the two systems?  It sounds like you don't from the error.  Here is a walk-through on setting up Unified Navigation although it assumes you have integration already working.  If you haven't done that, it's documented a hundred different places.
    http://remotepsadmins.com/2013/03/04/peoplesoft-unified-navigation-with-peoplesoft-applicatations-portal-interaction-hub/

  • My account is locked, i cant remember my security question, and I accidentally entered my itunes card in here instead of my other account, so can someone from apple help me out and fix my account

    my account is locked, i cant remember my security question, and I accidentally entered my itunes card in here instead of my other account, so can someone from apple help me out and fix my account (and no, i dont have any rescue email address or whatsoever)
    please help me because i dont to waste money for nothing

    Alternatives for Help Resetting Security Questions and/or Rescue Mail
         1. If you have a valid rescue email address, then use this procedure:
             Rescue email address and how to reset Apple ID security questions.
         2. Fill out and submit this form. Select the topic, Account Security. You must
             have a Rescue Email to use this option.
         3. This is the only option if you do not already have a valid Rescue Email.
             These are telephone numbers for contacting Apple Support in your country.
             Apple ID- Contacting Apple for help with Apple ID account security. Select
             the appropriate country and call. Ask to speak to the Account Security Team.
         4. Account security issues almost always require you to speak directly to an
             Apple representative to securely establish your identity as the account holder.
             You can set it up so that Apple calls you, either immediately or at a time
             convenient to you.
                1. Go to www.apple.com/support.
                2. Choose Contact Support and click Contact Us.
                3. Choose Other Apple ID Topics and choose the appropriate topic for
                    your issue.
                4. Follow the onscreen instructions.
             Note: If you have already forgotten your security questions, then you cannot
             set up a rescue email address in order to reset them. You must set up
             the rescue email address beforehand.
    Your Apple ID: Manage My Apple ID.
                            Apple ID- All about Apple ID security questions.

  • Help with writing and retrieving data from a table field with type "LCHR"

    Hi Experts,
    I need help with writing and reading data from a database table field which has a type of "LCHR". I have given an example of the original code but don't know what to change it to in order to fix it and still read in the original data that's stored in the LCHR field.
    Basically we have two Function modules, one that saves list data to a database table and one that reads in this data. Both Function modules have an identicle table which has an array of fields from type INT4, CHAR, and type P. The INT4 field is the first one.
    Incidentally this worked in the 4.7 non-unicode system but is now dumping in the new ECC6 Unicode system.
    Thanks in advance,
    C
    SAVING THE LIST DATA TO DB
    DATA: L_WA(800).
    LOOP AT T_TAB into L_WA.
    ZDBTAB-DATALEN = STRLEN( L_WA ).
    MOVE: L_WA to ZDBTAB-RAWDATA.
    ZDBTAB-LINENUM = SY-TABIX.
    INSERT ZDBTAB.
    READING THE DATA FROM DB
    DATA: BEGIN OF T_DATA,
                 SEQNR type ZDBTAB-LINENUM,
                 DATA type ZDBTAB-RAWDATA,
               END OF T_TAB.
    Select the data.
    SELECT linenum rawdata from ZDBTAB into table T_DATA
         WHERE repid = w_repname
         AND rundate = w_rundate
         ORDER BY linenum.
    Populate calling Internal Table.
    LOOP AT T-DATA.
    APPEND T_DATA to T_TAB.
    ENDLOOP.

    Hi Anuj,
    The unicode flag is active.
    When I run our report and then to try and save the list data a dump is happening at the following point
    LOOP AT T_TAB into L_WA.
    As I say, T_TAB consists of different fields and field types whereas L_WA is CHAR 800. The dump mentions UC_OBJECTS_NOT_CONVERTIBLE
    When I try to load a saved list the dump is happening at the following point
    APPEND T_DATA-RAWDATA to T_TAB.
    T_DATA-RAWDATA is type LCHR and T_TAB consists of different fields and field types.
    In both examples the dumps mention UC_OBJECTS_NOT_CONVERTIBLE
    Regards
    C

  • My Macbook is not working properly, I went to a Genius Bar appointment, they were not helpful at all and just told me to go off and reboot my Mac and then restore via TimeMachine. I dont know how to do this. I am extremely displeased with Apple, help me?

    My late 2011 Macbook Pro is not working properly it is very slow and extremely painful to use, I went to a Genius Bar appointment, they were not helpful at all and just told me to go off and reboot my Mac and then restore via TimeMachine. I dont know how to do this. I am extremely displeased with Apple at the moment, can someone please help me?

    Your problem description is generalized and non-specific. I would make another appointment at the Apple store and insist they help you execute their suggested fixes.
    Incidentally, if you search this site, Apple has excellent articles re: restoring a system.
    Barry

  • HT1926 hey guys,i tried to install the latest version of itunes but when i try to open it,it just comes up windows error 2 apple application support was not found,can anyone help me out and tell me what i need to do pls ?

    hey guys,i tried to install the latest version of itunes but when i try to open it,it just comes up windows error 2 apple application support was not found,can anyone help me out and tell me what i need to do pls ?

    If you run into the "another installation" message even after the reboot of the PC (which is an excellent idea by HTP ProXy), reregistering your Windows Installer Service is worth a try.
    First, launch a command prompt as an administrator. In your Start search, type cmd then right-click on the cmd that comes up and select "Run as administrator".
    At the command prompt:
    Type %windir%\system32\msiexec.exe /unregister and hit enter.
    Type %windir%\syswow64\msiexec.exe /unregister and hit enter.
    Type %windir%\system32\msiexec.exe /regserver and hit enter.
    Type %windir%\syswow64\msiexec.exe /regserver and hit enter.
    Restart the PC and try another reinstalll.

  • Using Search Help with ALV and Dynamic context node

    The topic subject already describes my situation.
    I have to create, populate and remove context nodes at runtime, and bind them to an ALV, to let user display the data or modify the data. The nodes I create are always typed with a table name, but the table name is of course, dynamic.
    This is all working: what's not working is help for entries inside the ALV; since the table has foreign keys and domains with check tables or fixed values, I expected that search helps were detected and managed by the framework.
    Instead, no help search is displayed except the input help based on data-type of the one "Date" input fields.
    I think I have to work on the dynamic node creation, and not on the ALV itself, since the latter only takes the node/attributes information, but i could be wrong. I tried with both the two following codings:
      CALL METHOD lo_nd_info_root->add_new_child_node
        EXPORTING
          static_element_type          = vs_tabname
          name                         = 'SAMPLE_NODE_NAME'
    *    is_mandatory                 = abap_false
    *    is_mandatory_selection       = abap_false
         is_multiple                  = abap_true
         is_multiple_selection        = abap_false
    *    is_singleton                 = abap_false
          is_initialize_lead_selection = abap_false
          is_static                    = abap_false
        RECEIVING
          child_node_info              = lo_nd_info_data .
    cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
          parent_info = lo_nd_info_root
          node_name = 'SAMPLE_NODE_NAME'
          structure_name = vs_tabname
          is_multiple = abap_true ).
    The result is the same...is there any way to let the ALV know what search helps it has to use, and doesn't force me to manually build a VALUE_SET to be bound on the single attributes? There are many tables, with many fields, and maintaining this solution would be very costly.

    I have checked with method GET_ATTRIBUTE_VALUEHELP_TYPE of interface IF_WD_CONTEXT_NODE_INFO, on an attribute which i know to have a search help (Foreign key of a check table).
    The method returns 'N', that is the constant IF_WD_VALUE_HELP_HANDLER~CO_VH_TYPE_NO_HELP. So, the framework was not able to find a suitable search help.
    Using method GET_ATTRIBUTE_VALUE_HELP of the same interface, on the same attribute, returns me '111', which is constant C_VALUE_HELP_MODE-AUTOMATIC.
    Therefore, the WD framework knows it has to automatically detect a value help, but fails to find one.
    Also, this means in my opinion that the ALV and the dynamic external mapping are not the culprits: since node creation, no help is detected for any attribute but the date. Honestly, I don't have a clue on what's happening.

  • Tax with the help of idoc and EDI

    Dear gurus,
    how can we process tax data that is used between two systems through the help of IDOC and EdI? It would be great for ur kind support.

    Hi Amit,
         I do not understand how a non-sap system having an idoc adapte?
    Do you mean the non-sap system has the ability to understand the IDOC files?
    If yes, then your scenario is typically a IDOC-to File scenario.
    Read this:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e07dcaa0-a92b-2a10-3a96-b3d942bd1539
    If you do not intend to use XI in between, then you can just configure the outbound IDOCs in your SAP system and configure a file port in we21 transaction and create the partner profile in we20 transaction.
    Regards,
    Ravi

  • Help getting worse and worse

    When CS5 went out, i spend a lot of time here trying to undertand what happened to the online help.
    I even stopped adding comment and being part of the community help because metric driven design is,
    as far as the help layout is concerned, a very very bad idea.
    My hopes were limited for CS5.5 and I really wanted Adobe to correct this in CS6...
    I wonder what happened with the online help part of Adobe apps in general, and AE specifically.
    I wanted to check some stuff on it, and it’s a complete disaster (at least in french).
    All the links in the "what’s new in cs6" are pointing to Todd’s blog home page, not even to the related post, and it even links to it when the topic is not disscussed at all on the blog. Hopefully, they all comes with another link to the home page of video brain, not even to the correct course or anything.
    I’ll be more specific; For a tutorial I’m recording, I wanted to check some info on the new material properties, because I’m not a 3D guy and wanted to use the correct french words and be sure not to mess-up.
    So I went to the online help home page, got in the what’s new in cs6 page, then scrolled down to new material option where it linked me to Todd’s blog and video brain. Both on the home page. Because I didn’t care about watching a video, and needed to read some stuff in french to get the correct words, I went to the Layer & properties part of the help.
    What a joy, 6 of the 7 topics wheren’t updated since january 1st (meaning no info about new stuff in CS6) and the only part updated is about 3D layers, yay ! So let’s open that page.
    I got 8 topics, none with info about the materials, old or new, only basics info about rotating,moving, 2d/3d layers, intersecting... and, on this "Product affected: Adobe After Effects CS6" page, info about Photoshop 3D layers, a feature removed from the product.
    That’s when I used that handy "search box", because that’s what I was told when I complained about how lame was the CS5 docs navigation compared to the CS4 one: the paradigm shifted from topic related discovery to keyword search related discovery.
    Let’s try to find out some info for the "Options Surface" category.
    it takes me to the community help results: http://community.adobe.com/help/search.html?searchterm=optionsurface&q=optionsurface&lbl=aftereffects_product_adobelr&x=0&y=0&area=0&lr=en_US&hl=en_US
    The first AE related link is 7th on the list despite a search in AE related docs... And on the 4 AE related links, nothing to do with what I need. Yes, I know, I searched the french name, but shouldn’t I get community results in french , or at least, official documention results in french ?
    If I select the "only adobe content" radio button, it’s worse. Less AE links, less relevant.
    If I click "support" instead of Community help, it’s not better, still more links pointing to Illustrator or Photoshop than After Effects. At least, 1 link is related to 3D layers in raytraced environment, but not what I’m looking for.
    Oh yes, now there's a topic browsing page. Let's have a try with that. Guess what ? Couldn’t find the info I was looking for.
    Removing the breadcrumb navigation in CS5 help was an ugly move, but this new help system is just... I don’t know how to say it politely. I haven’t been satisfied with the help system since CS5, when you removed the very usefull, always on context and organised bredcrumb navigation on the left hand side of the screen. I wished you stoped the "search" paradigm and went back to the "organised" one. I know your metrics shows people love searching. But how many search does they have to go through before getting the correct result ? How many unsuccessfull search before they don't bother anymore ? Honestly I’ve never seen such a messy help, and it really is confusing. It even feels like Adobe doesn’t bother about it anymore, and that it’s now relying only on external content, giving the feeling that the only thing up-to-date are the links to videobrain/creativecow/whatever rather than the official content itself. Hopefully, the curators for these links only points to very good tutorials.
    The other thing that is bothering me, is that we get more and more video content instead of text content. Don’t get me wrong, I love watching videos. But I also love to read the docs. It’s much more effective that trying to seek in the video for that special piece of info you are looking for (and there no way to know if the info you’re looking for is indeed in the video or not, or to "search" it's content).
    And don't get me started on the Help App, I never understood why you did it in the first place. Not as inconvenient as the website, but nearly.
    Not having an efficiant documentation is bad. I’ve been asking for an help redesign since CS5, complained in a blog post and on the community help forums. With this new non-sensical online help, where nothing is to be found easily, this will soon become mendatory. If Adobe doesn’t care for help anymore, they should remove it completly instead of making it less and less relevant, and more and more messy. If you have an email address where I can send this rant I’d be glad to let the right people know.
    Seb

    Thx for the reply Terri,
    i'll probably send you a mail with more thoughts, but what I feel from your answer is that you didn't get the major issue I have with the online doc since CS5.
    Sure it's nice to know that you'll fix your broken search engine and that you'll add some filters back (reference only). But the major issue here is your paradigm shift from indexed content to searched only content. Nothing can be found easily. Absolutely nothing. Either in localised versions or in the english version. The layout is nerve breaking, and the search results are really bad (but this is what you are going to fix someday soon).
    For an online help to be efficient we need properly organised and Indexed content first, and then a powerfull search engine to find it if we don't know where to look. Right now, you've wipped out the index & organisation and just piled stuff here and there leaving us the only way you think we want to browse the help: search. And that's the problem. We are not able to browse the help anymore; We can only search it, and we even cannot rely on that.
    Sincerly, go browse the CS4 online help. it was clear, and working like a breath with the always handy, and always displayed breadcrumb navigation. It also featured search. Now, go back to CS6, and tell me where is the improvment. No way to properly separate official docs, from adobe official blog posts, from 3rd party sites/blogs. Everything is mixed-up and unbrowsable. Even some of the "topic pages" makes no sens, as I demoed in my previous post. No way to keep on context. No way to explore more without returning back to the search results. Having more great content from 3rd party is really interesting, but it's poor integration with the official docs makes it an experience breaker.
    When I'm in my app and need help, I need to first and foremost go to the official help, I need it clearly organised and with an understandable and clean layout. And when I'm on my topic and feel I need more info/ in depth knowledge, a link to 3rd party tutorials, free or paying. And it's not the experience I'm getting. And it's the experience I need. I don't understand how it became so messy, but honestly, I've never seen something like that.
    Also, you've increased focus on video content. Yeah watching tutorial is cool. But video is not searchable. Video is not immediate. When I need help, I need to read the answer first to fix my issue, and then, if I feel I need to learn more, go to AdobeTV, Videocopilot, Videobrain & such to learn more stuff. Your enphasis on 3rd party and video content have shrank the volume of quickly available info. We need more text content, and more text content from within the official documentation, not from partners. Because once again, each time i'm redirected to a partner site, I loose context...
    So please, stop focusing on search only, and bring back the much stronger breadcrumb navigation, bring back in front the official documentation, so the info precise, findable, and not dilluted.

  • When I went to bed I had 3,000  song and multiple playlists.  This morning I have ~30 songs and no playlists.  What could have happened to my songs playlists?  I run iTunes on a Windows 7 64-bit machine.  HELP! (oh, and the Songs are not in recycle bin)

    When I went to bed I had 3,000  song and multiple playlists.  This morning I have ~30 songs and no playlists.  What could have happened to my songs playlists?  I run iTunes on a Windows 7 64-bit machine.  HELP! (oh, and the Songs are not in recycle bin)
    My wife's ipod nano was plugged into the machine overnight.
    When she went running with it, there were no songs on it.  She checked the computer and was horrified to see that the playlists had disappeared and most of the songs had disappeared.
    QUESTIONS:
    1. What could it be?
    2. How can I fix it?

    Hi, there alot of us suffering from this phernomonon but there is a forum topic about is already.
    https://discussions.apple.com/message/16767377#16767377
    Come check it out.
    Hope this works out for all of us.

Maybe you are looking for

  • Laserjet 1300 driver for Win7 problem

    Plugged my Laserjet 1300 into my new computer (System 7) via USB- and Windows couldn't find the right driver for it. I canceled Windows trying to install driver automatically, and put original CD driver disk (Serial #Q1334-60107 ver 2.0) into drive-

  • Cuda in premiere cs6 and After Effects 670 GTX

    I'm trying to activate cuda in those programs but the option appears LOCK, why? I bought that graphic card mostly because of that... O my god any idea please? I know I have to change something but I don't want to make a mistake or something THANKS.

  • Text under photos in Web-gallery

    How do I Put my own text under the photos when I create a web-gallery? If I use Custom, it will show the same under all photos, and if I use titles, I have to rename all, and then I can not use the same title for some... Lars

  • Photoshop elements 11 downloaded and created an attached folder containing 2 thumbnails. How do I change these settings?

    Since I've downloaded photoshop elements 11 every time I upload or download any photo onto my computer it attached a folder with two thumbnails. How do I change these settings?

  • Has anyone noticed this?

    I dont know if its just me but, if you try to put an app into an already full folder, the app itself will dissapear. It does not move to the side or anything, it just vanishes from the menu. If I searched my iPhone for it by name however, it does sho