Making a GUI take precedence over other threads.

Hi,
Basically what I'm trying to do is display a message on screen after a user has clicked a button that starts a thread which conducts a Bluetooth device search. This message needs to say "please wait" or "discovery in progress" or something and will disappear once the Bluetooth thread has finished executing.
Currently the way I am trying to achieve this is creating a thread which constructs and displays a JFrame with a progress bar in it, when the "discover devices" button is clicked. Also in the action listener for this button, the Bluetooth device discovery thread is started.
The problem I'm having is that when the button is clicked a grey box appears (the "please wait" message) however, it is empty until the Bluetooth thread has finished executing, at which time the progress bar and labels are filled in.
What am I doing wrong? How can I get the "please wait" form to be displayed fully before the Bluetooth discovery thread starts?
By the way if anyone can suggest an entirely different way of displaying this message, please do.
Many thanks.

You need to create a separate Thread for your long running task so it doesn't block the GUI Thread.
Maybe the link from the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html]How to Use Progress Bars will help.
You can also read this article on [url http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html]Using Threads.

Similar Messages

  • X509 Certificate is present in WSDL. Identity takes precedence over keystor

    Hi Experts,
    I deployed a web serivce on WLS 11g, with policy oracle/wss10_saml_token_with_message_protection_client/serivce. While testing the web services, I got:
    <Warning> <oracle.wsm.security.policy.scenario.util.ScenarioUtils> <BEA-000000> <X509 Certificate is present in WSDL. Identity takes precedence over keystore.recipient.alias>
    I've defined the keystores and credentials accordingly. I don't know what I missed getting the error.
    Any input is appreciated.

    It just warns you that you have overridden the keystore.recipient.alias (that you set in the configuration)
    by specifying a certificate in the WSDL - it could the identity provided by the certificate is not what you
    intent it to be.
    More information about overriding policies can be found here: http://download.oracle.com/docs/cd/E12839_01/web.1111/b32511/attaching.htm

  • Hi all, i can't sync over wifi between my iPhone 4 and Windows 7 64 bit, wifi sync works with the same phone and my Windows 8 machine, tried solutions from other threads with no luck, just thought i'd see if anyone else had any ideas, thanks.

    Hi all, i can't sync over wifi between my iPhone 4 and Windows 7 64 bit, wifi sync works with the same phone and my Windows 8 machine so the problem seems confined to Windows 7. I've tried solutions from other threads -
    Making sure everything is allowed through firewall
    Rebooting phone/laptop/router
    Disabling ipv6
    Disabling all networks except the one curently on
    Re-installing iTunes
    Restoring iPhone
    No luck with any of those unfortunately so i just thought i'd see if anyone else is still without wifi sync after trying those as well and if you ever found a fix, thanks.

    I just wanted to leave a note that it's working now. I'm not sure if it was the latest iTunes update that got it working or that i decided to start a new library instead of using the one i had backed up on Windows 8 (it didn't occur to me to check using the old library when i re-installed iTunes). But if anyone is having this problem, it might be worth trying again with a new installation of iTunes to see if the latest update works for you, and if not, try using a fresh library instead of a backup (by fresh library i mean discard your old library completely and start a new library, not just restore as new iPhone, a whole new library).

  • OS takes up over 3 GB of space. Can I minimize this as I am struggling with constantly managing the sync which is making me think the droid alternative with iTunes app is the better approach.

    I am restricted to a 16 GB phone and am constantly struggling with space when I sync or update. I noticed today that the OS takes up over 3 GB of space as the capacity is listed at 12.68 GB. Any suggestions on this other than get an android and use the iTunes app instead? Frustrated.

    No, the OS doesn't take up over 3GB of space.
    The difference between 16GB and 12.68GB is primarily attributable to the difference between decimal math (used by every computer and component manufacturer on Earth for stating capacity in customer facing documentation) and binary math, used by processors and operating systems. This has been an issue since the 1970's.
    Think more about managing the content and apps you actually keep on the phone. If you haven't used an app in months, you probably don't need it. Don't let your phone get cruffed up with games and apps you don't use. You also probably don't need to keep your entire media library on it for when you're on the go.
    Extract photos from the phone to your computer on a regular basis then delete them from the phone as you would from any other digital camera. Sync the photos you actually want with you to the phone. iCloud Photo Library may give some relief from this once it's out of beta.

  • One thread adding/updating value  and other thread getting values....issue

    am using a spring bean (singleton) and this is how it looks like
    public class MySingletonService {
    private Map<String, List<TaskVO>> alerts = new HashMap<String, List<TaskVO>>();
    //spring will call this method every 15 minutes
    public void pollDatabase() {
    //initialize the alerts instance variable and create/fill the alerts instance variable with new alerts for the employee(from database) .The key for the hashmap is the employee id
    //some client code (e.g. GUI) will call this method to get the alert for the operator id.This can be called anytime to get the latest info from the alert Map
    public List<TaskAlertVO> getOutstandingAlerts(String operatorId) {
    return alerts.get(operatorId);
    The issue here is that when getOutstandingAlerts is invoked by a thread,some other thread(Spring) calling the pollDatabase method might be updating the value.Please give me some idea and solution to get around this issue.
    I was thinking of creating a copy of alerts instance variable in the getOutstandingAlerts method and then use the copy to find the key and return the alert for that operator id.This way we dont have to worry about data conflict.
    Please advice

    Manjit wrote:
    jtahlborn wrote:
    if the pollDatabase() method is getting a complete new copy of the alerts every time, and the alerts map isn't being modified at all after load, then you can just:
    - make the alerts member variable volatible
    - create a new HashMap each time pollDatabase() is called, fill it in, and then assign it to the alerts member variable. Jtalhorn,I think I got your point.Basically you are suggesting that by creating a brand new map in each pollDatabase operation, then I dont have to worry about get operation ,simply because the client code is still looking at old memory location(old copy) and hence should not worry about values getting changes by pollDatabase method.
    I got it.
    But the small doubt is that why even I should bother about making the instance variable volatile ? Your suggestion should work without making it volatilebecause volatile ensures correct memory visibility between threads. if you didn't use volatile, then a caller to getOutstandingAlerts() could see some partially initialized/corrupt version of the map.

  • Can we assign the jobs of a thread to other thread

    hi
    need some help
    suppose say a thread A is running and doing some processing. Can this thread A, at a specified time delegate all its jobs to an other thread B, and exit
    gracefully? The thread B should take up the jobs left over by thread A and continue processing them.
    If so how can we implement this?
    please help me.
    thanks in advance
    sunil

    As has been said in other recent discussions regarding threads, a thread pool and a task queue would do the job.
    Two main decisions: How to break down the tasks at hand to allow a "graceful transfer" and how to activate the new thread?
    Regrading 1: You need to break down the overall task into subtasks, which can be performed by individual methods and that can pass on the state of excecution to the next step in the process.
    Either the processing sequence is predetermined or the next step is part of the result set of the current subtask. The queue then holds these tasks for assignment to threads.
    Regarding 2: Central thread generation vs. decentral approach: For a clean and debuggable design,
    you should go for one "factory" in you application, that is creating threads and handles task assignment. That has the additional benefit, that coordination and load-balancing can be implemented as well (to avoid too many threads or support partial paralel processing). Also, you should re-use threads, instead of letting them die and re-create new ones.

  • What the advantages of having an BAPI over Other data migrations

    What the advantages of having an BAPI over Other data migrations

    Th advantages of BAPI
    1. Simple to use (its just an FM)
    2. Not cumbersome like bdc
    where we have to record each and every screen
    sequence.
    3. SAP guarantees the consistency
    of bapi in future releases.
    One of the big plusses for BAPIs is that the interface and function are not supposed to change. This is a big plus when you do upgrades or hot packs because the transaction can change (format, required inputs etc) which means you then need to update the call transaction.
    Some of the BAPIs are better documented and easier to use than others.
    You usually need to perform the BAPI that actually does the COMMIT after you call your BAPI.
    The Program coding for calling a BAPI is usually cleaner than setting up the screen flow etc for the Call Transaction.
    You don't need to worry about special data circumstances interrupting the normal data flow of the screens and causing errors because of that.
    BAPIs probably have better performance since they don't do the screen flow processing.
    In general if the BAPI exists for the transaction you want to perform and you can figure out how to use it the BAPI is probably the best way to go.
    This is just from my experience working with both BAPI and Call Transaction. I have had some very good successes with BAPIs, but very occasionally found that I could not get the BAPI to perform the update I needed.
    Refer the transaction BAPI for detail information.
    You can also refer to below links:
    http://www.sapgenie.com/abap/bapi/example.htm
    Basic learning guide:
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    BAPI intro:
    http://www.sappoint.com/abap/bapiintro.pdf
    Overview:
    http://www.planetsap.com/Bapi_main_page.htm
    Also have a look at the following link :
    http://www.planetsap.com/LIST_ALL_BAPIs.htm
    Go through the following Document
    Bapi to create customer master
    BAPI_CUSTOMER_CREATEFROMDATA
    BAPI_CUSTOMER_CREATEFROMDATA1
    Or you can use FM SD_CUSTOMER_MAINTAIN_ALL
    what is BAPI?
    BAPI stands for Business API(Application Program Interface).
    A BAPI is remotely enabled function module
    ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..
    You can make your function module remotely enabled in attributes of Function module but
    A BAPI are standard SAP function modules provided by SAP for remote access.
    Also they are part of Businees Objest Repository(BOR).
    BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects.
    You create business objects and those are then registered in your BOR (Business Object Repository)
    which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA.
    In this case u only specify the business object and its method from external system
    in BAPI there is no direct system call. while RFC are direct system call.
    Some BAPIs provide basic functions and can be used for most SAP business object types.
    These BAPIs should be implemented the same for all business object types.
    Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs.
    Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.
    The following standardized BAPIs are provided:
    Reading instances of SAP business objects
    GetList ( ) With the BAPI GetList you can select a range of object key values,
    for example, company codes and material numbers.
    The BAPI GetList() is a class method.
    GetDetail() With the BAPI GetDetail() the details of an instance of a business object type are retrieved
    and returned to the calling program.
    The instance is identified via its key.
    The BAPI GetDetail() is an instance method.
    BAPIs that can create, change or delete instances of a business object type
    The following BAPIs of the same object type have to be programmed
    so that they can be called several times within one transaction.
    For example, if, after sales order 1 has been created, a second sales order 2 is created in the same transaction,
    the second BAPI call must not affect the consistency of the sales order 2.
    After completing the transaction with a COMMIT WORK, both the orders are saved consistently in the database.
    Create( ) and CreateFromData! ( )
    The BAPIs Create() and CreateFromData() create an instance of an SAP business object type,
    for example, a purchase order. These BAPIs are class methods.
    Change( )
    The BAPI Change() changes an existing instance of an SAP business object type,
    for example, a purchase order. The BAPI Change () is an instance method.
    Delete( ) and Undelete( ) The BAPI Delete() deletes an instance of an SAP business object type from the database
    or sets a deletion flag.
    The BAPI Undelete() removes a deletion flag. These BAPIs are instance methods.
    Cancel ( ) Unlike the BAPI Delete(), the BAPI Cancel() cancels an instance of a business object type.
    The instance to be cancelled remains in the database and an additional instance is created
    and this is the one that is actually canceled. The Cancel() BAPI is an instance method.
    Add<subobject> ( ) and Remove<subobject> ( ) The BAPI Add<subobject> adds a subobject to an existing object inst!
    ance and the BAPI and Remove<subobject> removes a subobject from an object instance.
    These BAPIs are instance methods.
    Check these Links out
    http://searchsap.techtarget.com/ateQuestionNResponse/0,289625,sid21_cid558752_tax293481,00.html
    http://www.sap-img.com/abap/interview-question-on-bapi-rfc-abap-objects-tables.htm
    http://www.sap-img.com/fu033.htm
    http://www.sap-img.com/abap/ale-bapi.htm
    Please check out this thread..
    Re: bapi
    Also refer to the following links..
    www.sappoint.com/abap/bapiintro.pdf
    www.sap-img.com/bapi.htm
    www.sap-img.com/abap/bapi-conventions.htm
    www.planetsap.com/Bapi_main_page.htm
    www.sapgenie.com/abap/bapi/index.htm
    Checkout !!
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    http://techrepublic.com.com/5100-6329-1051160.html#
    http://www.sap-img.com/bapi.htm
    http://www.sap-img.com/abap/bapi-conventions.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    Java Connector(JCO) can call not only BAPI's but also the function modules which are remotely enabled..
    BAPI's as i said earlier are remotely enabled function modules..
    Hence, JCO can call also BAPI's(n not only BAPI's as u mentioned).
    Check the following BDC over BAPI
    The steps to be followed are :
    1. Find out the relevant BAPI (BAPI_SALESORDER_CHANGE for VA02).
    [for VA01 use BAPI_SALESORDER_CREATEFROMDAT2]
    2. Create a Z program and call the BAPi (same as a Funtion module call).
    2. Now, if you see this BAPi, it has
    -> Importing structures.
    eg: SALESDOCUMENT: this will take the Sales order header data as input.
    -> Tables parameters:
    eg: ORDER_ITEM_IN: this will take the line item data as input.
    Note :
    Only specify fields that should be changed
    Select these fields by entering an X in the checkboxes
    Enter a U in the UPDATEFLAG field
    Always specify key fields when changing the data, including in the checkboxes
    The configuration is an exception here. If this needs to be changed, you need to complete it again fully.
    Maintain quantities and dates in the schedule line data
    Possible UPDATEFLAGS:
    U = change
    D = delete
    I = add
    Example
    1. Delete the whole order
    2. Delete order items
    3. Change the order
    4. Change the configuration
    Notes
    1. Minimum entry:
    You must enter the order number in the SALESDOCUMENT structure.
    You must always enter key fields for changes.
    You must always specify the update indicator in the ORDER_HEADER_INX.
    2. Commit control:
    The BAPI does not run a database Commit, which means that the application must trigger the Commit
    so that the changes are read to the database. To do this, use the BAPI_TRANSACTION_COMMIT BAPI.
    For further details... refer to the Function Module documentation for the BAPi.

  • Making a GUI freeze voluntarily

    Hi all,
    I use JOptionPane.showConfirmDialog(...) in my actionPerformed method in my class. After clicking the Yes button, a long non GUI operation takes place. Until the long non GUI operation completes its execution, the place where the showConfirmDialog was there is filled by gray background until the non GUI operation completes its execution.
    I used invokeLater() and also tried by creating separate THREAD. But what happens in my application is that there is one more message box say "Trade Submitted" is displayed even before the trade is submitted in the non GUI operation. Moreover, using thread requires lot of code changes. So usage of thread is restricted in my application.
    Is there any way of freezing the GUI(i.e., after clicking Yes button, my GUI should be there as such but the non GUI operation should start after clicking the Yes button). Once the non GUI operation completes its execution, I should return to the GUI operation(In our case "Trade Submitted"). Can you please help me on this issue.
    (NB: In my application, there are menus, which when clicked keeps the menu as such in the frame but starts the non GUI operation. I went through the code there, but there was no code logic there - to make the menu reside as such)

    Moreover, using thread requires lot of code changes. So usage of thread is restricted in my application.So, its better to desing to application correctly. If that means rewritting code then thats what you have to do.
    A modal dialog will block execution of the code until the dialog is closed. JOptionPane uses modal dialogs so it shouldn't be a problem.

  • Getting the default fileRealm to take precedence?

    I've got a custom realm which is doing a JNDI lookup as part of
    the getUser() function call, leading to infinitely looping recursive
    calls to getUser (since weblogic is checking my custom realm first).
    Is there any way to get the default file realm to take precedence?

    no solution. What do you mean, have "guest" always return true?
    I'm toying with the idea of trying to change the current user
    to be 'guest' or 'system' whenever a JNDI lookup is being done
    so that it will fallback to the file realm and always work, is
    that what you mean? (ie. my realm would be hardcoded to return
    null for a getUser with 'system' or 'guest', thus forcing the file
    realm to take over)
    I don't know how to change the current user for the context of
    that lookup of the DataSource and the following getConnection...
    my attempts at creating an initial context with a different user
    are failing, so if you've got something working that sets the current
    user to guest, I'd love to see it.
    -Don
    "Chris Danek" <[email protected]> wrote:
    >
    Good reading definitely, but it hasn't seemed to help
    me. Have you
    found a solution to your problem? I'm almost to the point
    of just
    letting "guest" always return true for that particular
    function....
    cd
    "Don Dwoske" <[email protected]> wrote:
    it seems we are having the same problem. look at the
    discussion
    tom and I are having.
    If you figure out a nice solution, let me know what you
    did.
    Does your code always go into an infinite recursion?
    Mine does
    not, which is confusing the hell out of me, it seemsto
    happen
    at random.
    -Don
    "Chris Danek" <[email protected]> wrote:
    I've got a custom realm which is doing a JNDI lookupas
    part of
    the getUser() function call, leading to infinitely looping
    recursive
    calls to getUser (since weblogic is checking my custom
    realm first).
    Is there any way to get the default file realm to take
    precedence?

  • Error while calling Receipt Un-application :Customer Transaction Identifier has taken a precedence over the transaction number

    Hi All,
    While calling the receipt Un-application API, I am getting a error like' Customer Transaction Identifier has taken a precedence over the transaction number'
    Kindly suggest as to how can I troubleshoot this?
    Appreciate your valuable Inputss

    Hi,
    i recommend having a Service request logged for this issue, as from related documentations in metalink most of them seemed to be a bug where oracle suggested patches (code Fixes) ... hence reaching oracle support would be a better approach ...
    Regards,
    Ivruksha

  • I just got a Time Capsule, and when I try to use it to extend my Airport n type network, it seems to take it over instead.

    Could I be doing something wrong to cause this? The Time Capsule is hanging off the network on an ethernet cable and can be accessed by all the Macs over wireless, but I would like to use it to strengthen the signal at that end of the house.  When try to set it up the extend the network, It seems to take it over and knock off the Airport Extreme and Airport Express currently on it.  When I initially set it up, I selected "Extend network" but it changed it on its own to create network.  I later changed it back to extend, but it then took over and I had to turn off its wireless to get the Epress and Extreme back onto the network.  I had just updated the Airport Utility to the latest version on my Macbook Pro and Mini, but I have an iMac still on Snow Leopard that I believe is still running an older version.

    Actually I am not sure how much it is able to export of the old settings but worth a go.
    The file is xml format .. so it could be possible to extract info anyway.
    ?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    You can always load 5.6 utility onto any version of the OS from Lion following.
    How to load 5.6 into ML.
    1. Download 5.6 for Lion.
    http://support.apple.com/kb/DL1482
    Click to open the dmg but do not attempt to install the pkg.. it won't work anyway.
    Leave the package open on the desktop so you can see the file. AirportUtility56.pkg
    2. Download and install unpkg.
    http://www.timdoug.com/unpkg/
    Run unpkg on the desktop.. If your Mac refuses to run the software, because it wasn’t downloaded from the Apple store, go to security in preferences and allow other software to work.. this is limitation of trade methinks. You can set back later if you like.
    Now drag the AirPortUtility56.pkg file over to unpkg.. and it will create a new directory of the same name on the desktop.. in finder, open the new directory, drill down.. applications, utilities .. there lo and behold is Airport utility 5.6 .. drag it to your main utilities directory or just run it from current location.
    You cannot uninstall version 6 (now 6.3 if you updated) so don't try.. and you cannot or should not run them both at the same time.. although I have had no problems when doing so.

  • HT201209 I have a code from a radio station to download a free song however when I go to redeem and put in my code which is typed correctly it just keeps making put my password in over and over. Any advice?

    I have a code from a radio station to download a free song however when I go to redeem and put in my code which is typed correctly it just keeps making put my password in over and over. Any advice?

    You can create an App store account without a credit card, however that won't help you with updating your previous purchases. Apps are DRM protected, and tied to the account that was used to originally purchase them. There is no way to overcome this DRM protection or transfer them to another account(Itunes support can if you contact them). If you want to create an App store account without a credit card, follow the directions here, but bear in mind the DRM protection mentioned. If you use this account to download free apps, you will have to use this same account for all future updates:
    http://support.apple.com/kb/ht2534

  • When viewing forums the cursor placed over the thread title would let me see the first sentence in the thread, now it is just a small blank box........any ideas?? Thx

    When viewing forums the cursor placed over the thread title would let me see the first sentence in the thread, now it is just a small blank box........any ideas?? Thx

    Yassssss...................that did it............................thank you!!!

  • Primitive data changes visible to other threads?

    I thought that if one thread changes an instance variable, the change may not be visible to other threads if synchronization is not used.
    Today I read that primitive types whose assignment is atomic are an exception. Is that correct?
    Maybe I'm not clear about the original idea. Is it simply that another thread might be in the middle of a method where the old value is in use? Or is it more complex than that? For some reason, I had it in my head that each thread somehow maintains its own "view" of memory.
    Thanks,
    Krum

    I think you are mixing two different things here.
    The assignment of most types are atomic. They either contain a value or not. This does not nessecarly mean that they are written to the main memory, they could still be in the thread-local memory area. Once they are being transfered, the transferation will also be atomic. Example of non-atomic is that longs and doubles are assigned the first 32 bits and then the rest of the 32 bits. This would for instance if two threads wrote to the shared memory, you could end up with the first 32 bits belonging to the change made in thread 1 and the last 32 bits belonging to thread 2.
    So, for a method that is not declared synchronous but assigns one single value before returning is "thread" safe in the aspect that one thread will manipulate the data on at the time. This does not however guarantee order. So, thread 1 can enter the method but not do the assignment, thread 2 enters the method, does the assignment that is imidiatly written over by thread 1. Synchronous would make sure that thread 2 could not enter until thread one written it's change.
    There is a reserved keyword 'volatile' in java that has the purpose of warning JVM's that a variable is not allowed to be stored in thread-local memory space, but as far as I know, no JVM implements this functionality properly.
    What the article states is that if you only do one assignment or return it will be executed atomically as long as we are not using long or double. It is a bit braver than I would say, since technically an reference assignment can be atomically assigned before the object is actually created (se articles from Doug Lea about the failure of double-checked locking ) and therefor some thread problem could occur as it might use an object before it is actually there.
    Regards,
    Peter Norell

  • [svn] 4648: If text and content are both set on TextGraphic or TextView, content takes precedence.

    Revision: 4648
    Author: [email protected]
    Date: 2009-01-23 14:33:27 -0800 (Fri, 23 Jan 2009)
    Log Message:
    If text and content are both set on TextGraphic or TextView, content takes precedence. Content can then be set to null to allow text to take precedence.
    If there is no text in TextGraphic or TextView should still be able to enter text. Set contentChanged when original empty textFlow is created to make sure a flowComposer is allocated in updateDisplayList().
    QE Notes:
    Doc Notes:
    Bugs: SDK-17307, SDK-16893
    Reviewers: will be Gordan
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-17307
    http://bugs.adobe.com/jira/browse/SDK-16893
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/TextView.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/TextGraphic.as

    Hello!
    I am trying to add photos into the left editable region and text into the right editable region. Nothing happens when I try to use the Insert --> Image command on the left region and I get this error when trying to add text to the right region:

Maybe you are looking for