Should I use a thread and (in this case) how?

Hi:
I have a Swing frame (frameA) and on which there is a button; if I double click it,
it will bring up a second frame (frameB). On frameB, I will select a new button name
from a combobox, and click "DONE" button, and frameB would change the name of the
button on frameA to this new name I selected. And frameB would disappear as well.
I am thinking of using another thread for painting frameB, because I don't know how long
it would take for frameB to load up, and I don't want to block up the event-dispatching thread
on frameA.
However, since frameB uses another thread, and frameB also has an ActionListener
associated with the DONE button, i am not sure how to make the thread stay alive
so that it could check whether the ActionEvent is fired. So, in this case, is it necessary to use
another thread to do the job? Or should I just use the same event-dispatching thread?
Or is there another whole new approach much better?
Thanks

Quite simply, I wouldn't bother threading it.
If you load, link and instantiate the pop-up frame (actually I'd use a Dialog here) before you trigger the pop-up, the reaction is more or less instant. The execution of th parent frame will continue after the pop-up has been made visible, so any way you cut it, you are going to get a brief pause in the parent UI while the pop-up is shown - you may as well have it when the button is clicked.
Hope this helps.--
<sig> http://www.itswalky.com http://www.crfh.net </sig>

Similar Messages

  • When should I use static variable and when should not? Java essential

    When should I use static variable and when should not? Java essential

    Static => same value for all instances of the class.
    Non-static => each instance can have its own value.
    Which you need in which circumstances is completely up to you.

  • My Macbook pro won't open downloaded programs. it just opens the code it was written in using the text and edit app. How can I fix this?

    My Macbook pro won't open downloaded programs, it just opens the code it was written in using the text and edit app. How can I fix this? I just bought the computer last month so this is some what frustrating.

    If you are downloading .exe files, those are Windows programs, and will not run on your Mac unless you install Windows on it.  (That is possible, if you need one of those apps.)

  • When should I use validate(), reValidate, and inValidate()?

    When should I use validate(), reValidate, and inValidate()? Also, I would like some detailed differences on them.
    Virum

    Anyone?

  • Recently, after cancelling the tick of a song, which is the next song after the one I am listening, in the song list, the canceled song will still run for the next song. I remember that it used not to happen like this. How can I solve this problem?

    Recently, after cancelling the tick of a song, which is the next song after the one I am listening, in the song list, the canceled song will still run for the next song. I remember that it used not to happen like this. How can I solve this problem?

    This looks like a change of behaviour in iTunes 12. Once songs are queued up to the Up Next list then they play whether ticked or not. If you want to skip certain songs already queued click the Up Next tool, then click the small X to the left of the song that appears when you hover over it.
    tt2

  • I am thinking of buying a iPad but my main desktop machine uses Windows 7 and MS Office.  How easy or difficult is it to transfer data files between the iPad and Windows?  Are there obvious problems or the need for some form of conversion programs?

    I am thinking of buying a iPad but my main desktop machine uses Windows 7 and MS Office.  How easy or difficult is it to transfer data files between the iPad and Windows?  Are there obvious problems or the need for some form of conversion programs?
    Many thanks for any advice.
    David

    You don't need conversion programs, iTunes can copy most of your content over to the iPad via the file sharing section, and some apps also support Dropbox, email attachments, transfer via your wifi network. There are a number of apps that you can get that support Microsoft office file (microsoft don't make an app versions of their software) e.g. from Apple there are Pages (word support), Numbers (excel) and Keynote (powerpoint), and from third-parties there are apps such as Documents To Go and QuickOffice HD

  • HT4824 My iPhone is running with ios 4.2.1 & current version of ios is 6.0.1 in this case how can i update my iPhone to ios 4.3.5? itune will show only latest version of ios.

    My iPhone is running with ios 4.2.1 & current version of ios is 6.0.1 in this case how can i update my iPhone to ios 4.3.5? itune will show only latest version of ios.

    If you have iPhone 3G, the latest and greatest is IOS 4.2.1.
    If you have iPhone 3GS or later, you can only update to IOS 6.0.1.
    For iPhone 5 and iPad mini, you can update to IOS 6.0.2.

  • How to use multiple threads and swing for displaying status/interaction

    I have a Swing-app which have to show progress and allow userinteraction for these tasks:
    * First:
    retrieve a list of IDs(String) from the database (single thread running)
    * Second:
    some work on the id-list and list written to hd (same thread as above)
    * Third:
    retrieve Objects (based on the id-list) from different sources (Multiple Threads are running)
    To show the status I have a JProgressBar (indeterminate while task1&2 running) and
    a JTextArea showing the current status (connect,retrieve list, sort, ...)
    When task3 is starting the JTextArea have to disappear and be replaced by a ScrollPane
    with an array of Labels/TextAreas showing the status of each thread.
    While theses threads are working, the ID-list will be consumed and the JProgressBar
    shows the remaining precentage of the hole progress.
    Everything is working so far (excepts UI :) , the problem(s) I have:
    I need the threads to interacts with the user through the ui. e.g: "Connection to db-xyz lost! reconnect?"
    But I don&#180;t know how to do this correctly.
    I think one way would be to send an event to the ui... but how?
    (the ui must know which thread is calling to unpause it after user answered)
    I know that threads should NOT change the swing(-container) - How do I notify the ui that a thread has a question?
    Since these threads are really time-consuming the UI is not updated frequently,
    how can I increase this? (perhaps using another thread-priority?)
    thanks for help!

    if/when your threads need to interact with the UI, they can create a Runnable & send it to SwingUtilities.invokeLater or invokeAndWait. This Runnable can popup a message to the user, and act on the choice of the user (reconnect, cancel, ...). This action could be something which "unpauses" the task thread.
    You may need to do synchronisation between the code in the Runnable & the Thread to which it is related - so the latter Thread knows when the user has made the choice.

  • Should I use both GetList and  GetDetail for creating a Data Object?

    Hello, all.
    At first, Thanks for your interesting.
    1. I wounder that  I can make a BAPI Wrapper as Data Object using only GetList.
    When I make a BAPI Wrapper as Data Object using only GetList, SAP shows me a message.
    The message says Data Object can have one root node only (hierarchy = 1 ).
    It means I should use both GetList and  GetDetail.
    I understand that.
    If i need to use only GetList, is there any way?
    Thanks for your interesting again.

    Hi
    I think you are trying to import BAPI wrapper as data object and you are using only "Getlist" BAPI.
    In such case, the data object created will have only root node. i.e Hierarchy =1.
    This is becuse the GetList BAPI has only the info about root node.(i.e, table parameter).
    If you have multiple tables in BE and you want to create a DO with multiple node(hierarchy >1) using BAPI wrapper import, then you have to use "GetDetail" BAPI along with GetList.
    Regards
    Rohith

  • I cannot get to or use my home pc for a while and am staying with a friend for the foreseeable and am using their pc to write this. How do I access my itunes account on their pc. Thanks Karen

    I cannot get to or use my home pc for some time and am staying at a firends and using their pc to write this. I need to access my itunes account and music on their pc. How do I do this. Thanks

    An easy route would be to use the iTunes Match service such that all your Songs are available anywhere over the internet via iCloud.  Once complete you can create an account on your friends PC, download iTunes and sign-in to the iTunes Store with your Apple Id, start iTunes Match and it will provide access to all your Songs.
    Not quite so good, is simply to follow the steps on your friends PC as above, however, instead of iTunes Match simply access the 'purchased' songs area from the iTunes Store home page that will give you access to all your purchases without iTunes Match.
    IMPORTANT:  Apple only like to see a single Apple Id associated with one device - so if your friend already has an active Apple Id account on the PC, it would be wise to use an alternate machine.  Apple has a 90 day lock out associated with switching Apple Ids on a common device.

  • 10g RAC - should I use RAW, OCFS and/or ASM ?

    I am about to install 10G RAC on RHAS3. Options for sharing disk partitions are raw, OCFS and ASM. The OCR and voting files must be raw or OCFS, I would tend to go for OCFS in this case. For the Oracle datafiles, again, I would tend to go for OCFS simply for ease of management since ASM seems to add another layer of complexity, and raw lacks flexibility. OCFS however is also new technology and may still have some stability issues. I'm not yet sure of our disk configuration, but there will be HBA cards in each machine with one or two SAN partitions, so I don't expect some of the ASM features such as mirroring etc. will be required as this will be done in the hardware. Does anyone have any recommendations or experiences(good or bad) in which way to go ?
    Philip

    We're using raw partitions for some years now, (since oracle 8i, then 9i and now 10g). It is quite flexible, but you shouldn't use physical partitions but LVM. It's very stable.
    Now on 10g we're using ASM on some sites where mirroring is needed. It works, but not so stable as raw. we discover some bugs as well.
    We've never used OCFS. I don't like it. To much limits. I belive that special utilities are needed for managing files. I don't like linux system software produced by oracle.

  • What printer should I use for pc and iPad iPhone use

    What printer(s) should I use on a wireless network that has pc, iPad and iPhone as devices?

    How to Print from Your iPad: Summary of Printer and Printing Options
    http://ipadacademy.com/2012/03/how-to-print-from-your-ipad-summary-of-printer-an d-printing-options
     Cheers, Tom

  • I have just started using iPhone 4s and cannot find out how to delete unwanted photos. I have used iPhone 3 gs for last 2 years and had no problem with this. Phone is connected to i cloud. Help please.

    I have just started using iPhone 4s and cannot find how to delete photos. Have used iPhone 3 GS for last 2 years and not had this problem. I have iCloud for my Apple family and don't know if this is causing problem. Help please.

    Log in to icloud.com with your Apple ID. Once you're logged in, click on your name on the upper right corner. Click Advanced and then Reset Photo Stream. This will delete all your photos in the album Photo Stream in your iPhone 4S so make sure you have backed up (copy to Camera Roll or new folder) all those that you want to keep.
    This is the only way to do it with iOS 5 (not the beta releases)
    http://iphone-and-i.blogspot.com/

  • When to use the Adapters and in which case

    Hi Experts,
                         I am little worried and searched the sdn, but i am not getting the proper answer for my question.
    My Question is when to use which adapter and at what stage?
    1. File      --> when to use it and in which case
    2. IDOC
    3. RFC
    4. SOAP
    5. XI
    6. HTTP
    And also where to use BPM and Proxies, when should we go for them.
    Please help me out. I Beg the answer from experts.
    Regards,
    Raj

    Hi,
    If an incoming or outgoing message is a file(.txt,.csv etc), we use a file adapter
    If the outgoing message is an IDOC, we need an IDOC adapter.same for RFC also.
    SOAP for incoming/outgoing webservices
    XI while using proxy scenarios
    HTTP- while you an HTTP request.
    BPM and Proxies is a vast topic.
    For Proxies http://help.sap.com/saphelp_nw04/helpdata/en/5d/112d20f6ce6c46ba66afb98d278fbd/frameset.htm
    and for BPM http://help.sap.com/saphelp_nw04/helpdata/en/5d/112d20f6ce6c46ba66afb98d278fbd/frameset.htm
    this will be useful.
    Regards,
    Tiny

  • I had somebody  work on my OS 10.9.2 to speed it up. He failed and now  Preview, Textedit, App Store, Mail and Contacts  do not work anymore. I can still use Safari, Firefox and iPhoto etc. How do I get it fix I can still use Safari, Firefox and ed again?

    I had somebody  work on my OS 10.9.2 to speed it up. He failed and now  Preview, Textedit, App Store, Mail (crashes) and Contacts  do not work anymore. I can still use Safari, Firefox, Word, Photoshop and iPhoto etc. How do I get the Apple programs fixed again?

    Try these in order testing your system after each to see if it's back to normal:
    1. a. Resetting your Mac's PRAM and NVRAM
        b. Intel-based Macs: Resetting the System Management Controller (SMC)
    2. Restart the computer in Safe Mode, then restart again, normally. If this doesn't help, then:
         Boot to the Recovery HD: Restart the computer and after the chime press and hold down the
         COMMAND and R keys until the Utilities menu screen appears. Alternatively, restart the
         computer and after the chime press and hold down the OPTION key until the boot manager
         screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    3. Repair the Hard Drive and Permissions: Upon startup select Disk Utility from the Utilities menu. Repair the Hard Drive and Permissions as follows.
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the main menu. Select Restart from the Apple menu.
         Reinstall the 10.9.2 update: OS X Mavericks 10.9.2 Update (Combo).
    4. Reinstall Lion/Mountain Lion, Mavericks: Reboot from the Recovery HD. Select Reinstall Lion/Mountain Lion, Mavericks from the Utilities menu, and click on the Continue button.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible because it is three times faster than wireless.
    Reinstall the 10.9.2 update: OS X Mavericks 10.9.2 Update (Combo).

Maybe you are looking for