SwingWorker - why can't I do this

//StringWorker.java
package myPackage;
import javax.swing.SwingWorker;
public class StringWorker extends SwingWorker<Void, Void>
      public StringWorker(String s)
            s = new String("Today is a sunny day.");
      protected Void doInBackground( ) throws Exception
            return null;
//Driver.java
package myPackage;
public class Driver
      public static void main(String[] args)
           String str = null;
           StringWorker sw = new StringWorker(str);
           sw.execute( );
           while( !sw.isDone( ) )
               System.out.println("Wait...");
           System.out.println(str);
}Output:
Wait...
null

Try this:
//StringWorker.java
package myPackage;
import javax.swing.SwingWorker;
public class StringWorker extends SwingWorker<Void, Void>
      public StringWorker(String[] s)
            s[0] = "Today is a sunny day.";
      protected Void doInBackground( ) throws Exception
            return null;
//Driver.java
package myPackage;
public class Driver
      public static void main(String[] args)
           String[] str = new String[1];
           StringWorker sw = new StringWorker(str);
           sw.execute( );
           while( !sw.isDone( ) )
               System.out.println("Wait...");
           System.out.println(str[0]);
}You have quite some reading to do. Here is something about Strings. Here is something about Objects. No claim as to completeness.

Similar Messages

  • I am unable to apply my downloaded update. When I try to apply it and restart firefox, it still says 'apply downloaded update now...'. Why can't I apply this update and what do I do about it?

    I am unable to apply my downloaded update. When I try to apply it and restart firefox, it still says 'apply downloaded update now...'. Why can't I apply this update and what do I do about it?

    Checked out that link and everything seems to be in order on this machine at this time.
    I only have CC installed on this one machine, not even my secondary machine like is permitted. it seems odd that I'm asked to re-accept the Licence Agreement as often as I am. If I had to guess, it's almost every week, if not multiple times some weeks, that all the software will decide I should have to view the licence agreement.
    Edit: I've never had any noticeable "errors" activating or anything like that. I just get asked to do it quite frequently.
    This activation screen isn't too annoying (it involves clicking one single button), but like I stated earlier, if I'm trying to launch the software by double-clicking on a PSD, AI, PPROJ, AEP, etc... that file will fail to open.
    I feel like that's probably not really a bug, but it is frustrating, since I did launch the application with the intent to edit that specific file I tried to open.
    Again, something that you guys may consider working on.
    Another annoyance is that: agreeing to the licence agreement is a per-application task, so if I see that Licence Agreement dialogue window by opening Photoshop (for example), I know that every other piece of software I have in the suite (Illustrator, Premiere, After Effects, Audition) will be showing me that screen on it's next launch. Probably deliberate for legal purposes that I can't just agree once for the whole suite, but heck, it would save me a lot of minor headaches if it was a unified agreement.

  • I want to change my primary email address, and use one already associated with my account why can I not do this ?, I want to change my primary email address, and use one already associated with my account why can I not do this ?

    I want to change my primary email address, and use one already associated with my account why can I not do this ?, I want to change my primary email address, and use one already associated with my account why can I not do this ?  I don't want to create another one if I really don't need to
    Any ideas ?

    I'm afraid that once an address has been associated with an Apple ID you can't re-use it in any way. You will have to create another address (such as a free on from GMail or Yahoo for example).

  • Whenever I modify a photo in Iphoto it puts it in a "modified" subfolder. Why can't I move this modified file (I changed name) back to the Iphoto main file so I can see it when I open my photos?

    Whenever I modify a photo in Iphoto it puts it in a "modified" subfolder. Why can't I move this modified file (I changed and saved file name) back to the Iphoto main file so I can see it when I open my photos?

    A good general step for strange issues is to renew the iPhoto preference file - quit iPhoto and go to "your user name" ==> library ==> preferences ==> com.apple.iPhoto.plist and trash it - launch iPhoto which creates a fresh new default preference file and reset any personal preferences you have changed and if you have moved the iPhoto library repoint to it. This may help
    This does not affect your photos or any database information (keywords, faces, places, ratings, etc) in any way - they are stored in the iPhoto library - the iPhoto preference file simply controls how iPhoto works - which is why renewing it is a good first step.
    If that does not cure it backup up your iPhoto library and rebuild it - depress the option and command keys and launch iphoto and use the options there - exact option depends on teh version you have
    And always remember - NEVER make any changes of any sort to the structure or content of the iPhoto library - nothing - no deletions - no name changes - nothing
    LN 

  • HT1528 Why can't I bookmark this page like I can with support.discussions pages?

    Why can't I bookmark this page like I can with support.discussions pages?

    Hi UI Guy,
    I can't provide the technical reason, however, I'm farilry certain it is a function of Forum structure itself.
    Don't know if you are interested in suggestions to meet your need to "bookmark pages within the Apple Support system so you can refer back to them easily", but I use them regularly, and do this one of two ways (I use both):
    If it is strictly an Apple Support page that I retrieved from Apple, I bookmark it with clear easy to find names, and put them in my Apple Support Folder in my bookmarks (I use Firefox). That way, when I need to provide a link to someone I'm replying to, I can quickly find the item I want them to be able to link to.
    I also bookmark discussions that have links in them that I may want to use, and tag them so I can find them later.
    I have to say, however, that for Apple Support Pages, the best solution for me has been to have my Apple Folder with my personally named bookmarks in Firefox. Easy to find, easy to cut and paste into a discussion on a separate window, easy to reference when I need to know something.
    Again, don't know if you even wanted to know any of that, but thought I'd share!
    Cheers,
    GB

  • A Playlist idiot. Why can't I get this to work?

    In iTunes I have music Playlists set to shuffle (blue double arrow button) and audio books Playlist set no shuffle. I have been unable to get my iPod to follow these settings. A suggested work around is to use the iPod Settings to set the shuffle function to "songs" when playing music and then switching to “off’ for audio books. There has to be a better way. How do I set the Playlists on my iPod to function the same as it does on iTunes?

    LeftyLucy,
    Using your process are you able to set your iPod to shuffle then listen to the audio book without it shuffling the chapters? I have tried your suggestion with the iPod setting set to shuffle and the chapters shuffled. This is the issue from my original post. I want to listen to music with the shuffle function and listen to audio books (no shuffle) without having to change the settings every time I switch.
    Keep in mind that is not a purchased audio nor a imported book.
    Using a tip from the following post:
    Tom Graves, "A Playlist idiot. Why can't I get this to work?" #11, 05:26pm Sep 28, 2005 CDT
    I have attempted to make the audio book file into an authenticate file but that did not help.

  • Why Can't Creative do thi

    Why can't Creative do this with the headphone jack problem?
    http://www.sony.co.uk/PageView.do?si...=en_GB_Support

    Do we need another thread on this? It could be that Sony's problem is a very serious fault like a fire hazard with the battery or something.

  • HT4009 I have a Ipad Mini and want to load Slotomania.  It will not let me do this. I currently have that game on my IPod Touch and my daughter has Slotomania on her IPad Mini.  Why can't I load this game on MY IPad Mini???????

    I have Slotomania on my IPod Touch and my daughter has Slotomania on her IPad Mini.  Why can't I get this game on my Mini??

    What happens when you try to install it?
    What happens when you try to redownload it directly to the iPad by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • Two Apple IDs Why can't you fix this?

    Why can't you fix the problem for those of us who ended up with multiple Apple IDs and permit us to merge just once? I understand that IDs are tied to software updates but surely you chave the capability tod o this?

    These are user-to-user forums, they are not monitored by Apple (there are too many forums/threads/messages for that to happen). It is not currently possible to merge, or transfer content between, iTunes accounts -  if you want to leave feedback for Apple then you can do so here : http://www.apple.com/feedback/itunesapp.html

  • Why Can't QuickTime Do This Anymore?

    About a year ago, I used to be able to create muxed MPEG-2 TS (transport streams) using Compressor and open them using QuickTime. Of course I have the MPEG-2 plugin for QuickTime too. However, it seems QuickTime can no longer open MPEG-2 TS files. I can still create them using Compressor, but only MPEG Streamclip can open them, QuickTime cannot. I can't believe this shareware program can do something Apple can't. It MUST be a legal issue involving QuickTime. Does anyone know for sure? I have spent a lot of time looking for the answer to this. Why can't QuickTime play TS files?????

    MPEG Streamclip is a better all around solution so instead of figuring out why Apple did something move on to a superior multipurpose and conveniently, free, application as you have found.

  • Why can't I delete this video file from my trash can?

    I have a video file that I will not disappear from my trash can when I click the "empty track" button. I managed to move the folder containing the video file from documents to the trash after a lot of effort, but it kept telling me that I didn't have the privileges necessary to delete the video permanently. Now the video file is sitting inside a folder inside the trash can where I can't move anywhere else. If I try to move it anywhere else, it simply copys to that folder but stays inside the original stays in the trash can as well, but I can still delete the copy and the original stays sitting in the trash can. Can anyone help me so I can get rid of this file once and for all.

    ho yeah .. i know that, but i tried even in a low quality and it's not worked.
    Maybe it's related to the TimeQuick?

  • What is local storage? Why can't I get this app?

    So I'm trying to get the sims free play app on my ipod4g. It requires 569MB. So I click download and it says I do not have enough local storage. Which I clear do cause I just deleted almost everything off my iPod. I have 1.0GB of free storage left. I don't get it??? Why can't I get the app???

    You do NOT have enough space.  Most apps require 2 or 3 thimes the space required in order to install the app.
    You will need 1.2 - 1.8 gb or so free

  • "While executing canInspectSelection" Why can't Adobe address this?

    I downloaded some widgets from Adobe exchange, including some from YUI and PhatFusion. Since then I keep getting the "While executing canInspectSelection" error 11 times (I have eleven widgets in all, I guess) when I try to edit any library item, and on other occasions. I click OK 11 times and I can work on the page.
    Using Dreamweaver CS4 on a G5 Mac, upgraded from CS3 (still on my hard drive), using Extension Manager CS4.
    I see this asked about in the forums and on other sites, but I never see it dealt with by Adobe so we know how to get rid of those warnings.
    Can't Adobe check this out and offer users some solutions? It must be a frequent problem for many Dreamweaver users. I am getting very frustrated about this...
    Thanks,
    Doug Dye

    This is an extension code problem (from the mxp file), the message you are getting is Dreamweaver checking the inserted (or potentially inserted), item. It may also be a conflict of items (2 extensions doing the same thing) the only way to fix this is:
    1. uninstall one of the conflicting items.
    2. Contact the extension builder and see if they are aware of the conflict, (many are not, and rely on feedback).
    Building an extension change when it became a CS product any many of the older extensions now conflict with the DW API, (the old Macromedia API was much easier to use).
    The canInspectSelection() is a JavaScript function from the Dreamweaver API.
    The only way Adobe can solve this problem is by only allowing a limited number of extensions (neither desirable or wanted).
    HTH
    PZ

  • All I want to do is upgrade two phones ... WHY IS THIS SO HARD?  And, WHY CAN'T VERIZON DO THIS???!!!

    In the past month, I've spoken to dozens of Verizon reps on the phone, been disconnected a few times, been at 4 different stores, been told several different things by EVERYONE, been told "oh sure, we can do that" only to be told by someone else "no we can't" ... how can you run a business like this??!!!
    I AM SO FRUSTRATED RIGHT NOW I COULD SCREAM!!!!!!!!!!!!!!!!!!!!!
    First, it was because our account was listed as a monthly paid cash account,
    then, it was because we were trying to get phones at a franchise store,
    then, it was because our account was set up as a business account (according to the Verizon rep I met at Wal-Mart, even though the Vz reps on the phone tell me it's listed as a personal account AND I sign onto our account as a personal account)
    then, we were told to order our upgrades on over the phone (but then we were told we would have to pay for the phones and wait for a debit card rebate to be mailed to us, which my husband does not want to do)
    then, we were told to order the upgrade phones online, but every time I try I get a processing error,
    then, the computer tells us to call a specific phone number if we believe the error was not right,
    then, the phone recording message repeats itself through multiple options TWICE and then hangs up on me,
    then, I call another Verizon number and get a "helpful" rep who tells me we can order them on the phone ... only to come back to me after being on hold and telling me they have gone home for the day,
    then, I try to get help online at Verizon.com and NO ONE IS AVAILABLE TO HELP ME.
    I've been to Wal-Mart 3 or 4 times, been to the local franchise store, been to a store in the Chicago area, and have spoken with Verizon reps on the phone until I'm blue, and, still ... STILL ... I don't have new phones.
    (removed) ALL I WANT IS TO UPGRADE OUR 2 PHONES ... WHY IS THIS SO HARD???!!!
    We have been a Verizon customer for over 16 years, apparently that means NOTHING.
    Edited as required by the Verizon Wireless Terms of Service
    Message was edited by: Admin Moderator

    That is because the people who edit the posts are NOT CS agents but instead are people who are employed by the vendor Verizon has contracted to host the forum. I don't even believe they are Verizon employees, but employees of the Jive forum platform.
    For example, if a Verizon store had an electrician repairing the lighting in one of their stores, you wouldn't necessarily walk in and expect them to get off their ladder to assist you with information about a phone since they had nothing better to do than to work on the lights.  First of all, they aren't salesmen or CS agents. Second, they may not even have the capability to give you the assistance you are requesting.

  • Installing on Macbook Air 4,2 - why can I not get this done?

    I am trying so desperately to install Arch and dual-boot on my Macbook Air.  I'm not an Arch noob - I promise.  I've installed and loved arch on my old laptop a couple years back but that was not a mac. 
    I've been here but all it says is that this "works out of the box".  Unfortunately, I can't get that far.
    I flashed Archboot to my USB thumb stick using DD and booted into it using ReFind.  I can't remember what the first option was, but I believe it was Arch-something with EFI.  I chose that and I got an error message: 
    Failed to open file:  boot\intel-ucode.img
    Trying to load files to higher address
    Failed to open file: boot\intel-ucode.img
    So, I chose the second option which says (I'm sorry, I'm in my OSX right now so I'mg telling this from memory) something like Arch-something without EFI.  Then I got to the actual install console.  I created some partitions using cgdisk and chose my packages but they all failed to install due to a dependency missing.  I'm really sorry I don't know what that error was.  After I post this I will go back and try again and see if I Can get a screen shot.
    Anyhow - This is nothing like my install was on my old PC laptop and I feel like I'm not even sure if I'm going down the right path.  Does anyone know of a youtube video which shows this process?  Honestly, as much as I've used Arch in the past, I truly feel like a dumbass right now but I'm willing to risk my reputation for a rig that runs the sweetest Linux there is.
    Thanks -
    Whatever you need, logs, etc... no problem - but tell me where to get them because I'm not sure how to with my system in limbo like this.

    Alright, only problem is that the beginner's guide talks about entering things at a prompt - like "# sgdisk --zap-all /dev/sda".  i'm not at a prompt.  I'm in the GUI Archboot console.  Also, I don't see instructions on which partitions to create, what size to make them, etc..  and, I still don't know why the original option in Archboot failed - the one that prompted me that it could not find boot/intel-ucode/img.  It's not that I haven't read the documentation and it's also not that I'm too stupid to figure it out - I feel like I'm on the wrong track. For example, the Beginner's Guide doesn't even mention instructions for Archboot - which is what I'm using.  By the way, thank you for your response.  I don't want to sound ungrateful
    Last edited by burgertime (2014-12-21 02:08:22)

Maybe you are looking for

  • Total and subtotal in alv

    hi, i have an ALV REPORT,displaying the fields such as po item(ekpo-menge).the data type is qunt. but i am unable to perform total and sub total,it gives me a information message 'total cannot b performed'.   even i tried with  X_FIELDCAT-DO_SUM = 'X

  • Time Capsule w/iTunes Master Lib not connecting

    I have a Time Capsule and put the iTunes Master Lib on it.  I connected to it with a Windows 7 machine and iPad 2.  I am now trying to connect my Mac ... now nothing can find the master library, and I can't see to set the Mac iTunes master lib to the

  • No Signal No Camera

    Hello I broke my iphone 4s(it fell down from a high distance), and I took it to a repair shop.  They changed the screen, but there was no signal and the camera didn't work. In the up left corner, it shows (searching) all the time, and the carrier ico

  • Solaris Appears to Hang on Boot - No Login Prompt/X Doesn't Start

    Hi, I've using Solaris for just a few days, and I'm starting to get somewhere with it, but I've hit a problem I'm not sure how to resolve. The system appears to boot normally up to the point of the prompt "Wait for the login screen before attempting

  • The Bob Dylan Movie on iTunes Store won't transfer after purchase

    I have used iTunes Store for years and have no problem of transferring music and videos to my iTunes. However, I recently purchase the Bob Dylan movie on iTunes and it keeps coming up with an error 50 that says check connectivity to the network. The