What could I possibly pass to setText() that could make it hang?

I'm writing my own text editor called Bix. I've discovered that if I load a file whose path was taken in as a command line argument (as opposed to getting it with a JFileChooser), the function doOpen() hangs at setText(). This often--well, always--happens when the program is called from a different folder via a shortcut.
The main function and the function doOpen are defined below:
public static void main(String[] args){
        Bix thisBix = new Bix();
        thisBix.show();
        if (args.length > 0){
            File f = new File(args[0]);
            thisBix.doOpen(f);
boolean doOpen(File f){
        boolean success = true;
        String fname = f.getName();
        String fpath = f.getPath();
        FileInputStream fis = null;
        String str = null;
        try {
            fis = new FileInputStream(f);
            int size = fis.available();
            byte[] bytes = new byte [size];
            fis.read(bytes);
            str = new String(bytes);
        } catch (IOException e) {
            success = false;
            JOptionPane.showMessageDialog(this,
                    "The file " + fname + " could not be read.\nReason: " + e.getMessage(),
                    "File Loading Problem", JOptionPane.ERROR_MESSAGE);
        } finally {
            try {
                fis.close();
            } catch (IOException e2) {
                System.err.println(e2);
        if (str != null){
            if (confirmReconditionFile(str)){
                str = FileConditioner.conditionForEditing(str);
            } else {
                translateEnabledBox.setSelected(false);
                tabsAsSpacesRatio.setSelected(false);
            textArea.setText(str); //SOMETIMES SETTEXT HANGS HERE
            textArea.setCaretPosition(0);
            updateState(f);
            undo.discardAllEdits();
            previousFiles.push(f);
            return true;
        return false;
    }If I call System.out.println() with str just before I call setText(), the contents of the file are printed just fine.
What gives?
Any help would be appreciated...
tim

Probably you have troubles because you are trying to update your GUI outside of Swing event dispatching thread. Try to use SwingUtilites.invokeLater().
Denis Krukovsky
http://dotuseful.sourceforge.net/

Similar Messages

  • HT1665 what is gmate+? is it true that gmate+ make ipod to a phone?

    what is gmate+? is it true that gmate+ make ipod to a phone?

    That requires jailbreaking and can't be discussed here.

  • What could make a A135-S4478 slowdown in relatively short time period

    Alrighty, Had this thing a good while now guessing over a year since I paid off the debt from it.
    This has by far been one of my best laptops - I run a home based business as a programmer and am pretty hard on these things(I.E. constantly on and about 10 hours of usage a day)
    The only problem I have experience is about 2 months ago I had one of the ram slots dumped on me so I bought a 2 gig chip and took the 2 1 gig chips out.
    As of late within the last month I have notice a HUGE slowdown that is beyond annoying at this point. Its not just browser but outlook and my IDE(development enviroment), quicken just about anything...can take forever to paint or take input sometimes during its normal run. Network seems fine as its not the data that takes so long on say IE its more that it can't keep up with the processing needed to paint the page fast enough.
    I run norton 360 as I have for quite a while and so don't think its spyware/malware/virus at this point. Harddrives aren't defragmented. All seems alirght in computer land as far as I know.....
    What could be going on here????

    Hi,
    From which manufacturer is this newly purchased and installed memory module? Do you know the timings and the FSB speed from it? Maybe the old modules were a little bit speedier which could easily explain the "slow-down". It´s the same with notebook harddrives: the differences are slightly but as someone which works the whole day with his workstation you will relatively quick recognize how the performance differs...
    Greets

  • What Could Make My iMac Stutter As It Records?

    Until recently my iMac would record flawlessly when recording via the iSight camera or when importing from my DV camera, but now it stutters and stops? I have tried other programs on the web like Vidi and it's the same problem.
    I am now suspecting a computer hardware problem. What could the problem be and how easy would it be to fix?
    I am using a 2.16 GHz Intel Core 2 Duo.

    Hello, Robert.
    It may be better to post you're questions in the iMovie 6 (or '08) Discussions pages as opposed to the more general Snow Leopard side of these Discussions.
    That said, I would run the "Hardware" tests found on the Snow Leopard DVD to try and rule some things out.
    Have you tested the external camera using a different Firewire cable?
    Does the camera have "external" power supply attached?
    What software are you using to record the built in iSight camera?

  • What could make a JOptionPane visible but not showing?

    Hello,
    I use FEST-swing to implement automated validation tests of a GUI application.
    At one point the conversation being tested involves a modal dialog implemented using one of JOptionPane.showXxxDialog(...) methods.
    When I automate cancelling the dialog (clicking the cancel button), I also check that the dismissed dialog is now hiding (FEST's dialogFixture.requiresNotVisible() , which in the end calls theDialog.isVisible() ).
    My problem is that sometimes (I haven't identified any correlation so far), the dialog is still visible ( isVisible==true ), which fails my test, whereas on eye-witness inspection, the dialog is indeed not shown on the screen, and on code-tracing, it is not showing ( showing==false ).
    - One trail to investigate could be improper usage of the EDT, but FEST-swing is supposed to issue Fixture checks on the EDT. I'll report that to the apporpriate mailing list.
    - Another trail is, do you see a reason why the JOptionPane's dialog, could have visible=true and showing=false?
    I'm sorry, I cannot produce an SSCCE (it works in simpler cases, plus it would require using the FEST-swing library).
    Thanks in advance, and regards.
    J.

    I should add that I use a something.waitForIdle() method in the testing lib API that supposedly wait until there are no more event in the EDT, and I also put manual Thread sleeps to let stuff happen. So I don't think it's related to e.g. the "bringing down" not having finished to processed when I check the visibility. But of course, you are encouraged to question my assumptions :o)

  • Possible events or items that trigger an Mail notification on iphone 5?

    What are the possible events or items that trigger a Mail notification to be sent to my iphone5?  I have the Mail notification set to "on" and set up as a banner and wondering what the potential list of notifications can be beyond that a new message was received (with a little preview of the msg) or that I have a certain number of unread messages? 

    Hello WPBIL,
    If you enable Alerts for Mail, it will provide you a notification for just new emails.  I recommend reviewing the following resources for more information about Notifications. 
    iOS: Understanding Notifications
    http://support.apple.com/kb/HT3576
    You can also find information on page 28 of the iPhone User Guide:
    iPhone User Guide
    http://manuals.info.apple.com/MANUALS/1000/MA1565/en_US/iphone_user_guide.pdf
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • What are the possible errors that can happen in data loads(rsmo monitor)?

    hi all,
    what could be the error that could result in red color in the RSMO  monitor of data load transaction?
    1. request everything ok
    (what are the possible error type which make here red)
    2. extraction everything ok
    (what are the possible error type which make here red)
    3. transfer (idocs and trfc) error occured?
    (what are the possible error type which make here red)
    4. processing
        - data package
    5. process chain
    (what are the possible error type which make here red)
    6 other messages.
    (what are the possible error type which make here red)
    thanks
    pooja

    Hi,
    I can tell you the most common reasons of these failures.
    1. request everything ok
    Here it will be telling you if the request was properly send to source system and got triggered there.
    2. extraction everything ok
    In this step the actual extraction of data happens, issue slike sysfail or CPIC error may cause this to fail.
    3. transfer (idocs and trfc) error occured?
    When extraction is complete and data is being send to BW. But if dur to some reason it fails, error may come here.
    4. processing
    Processing in BW fails for each data packet is displayed here.
    This can also happen when you have sysfail in source.
    5. process chain
    This can show the logs of the chain here and also status of subsequent process.
    6 other messages.
    Any other error message.
    Refer
    What is the information we can get the through details tab in RSMO
    working with RSMO errors
    http://help.sap.com/saphelp_nw70/helpdata/en/12/43074208ae2a38e10000000a1550b0/frameset.htm
    Also
    Data Load Errors
    /people/siegfried.szameitat/blog/2005/07/28/data-load-errors--basic-checks
    Data Load issues
    Errors in loading
    data loading errors
    load Errors
    Process Chain Errors
    /people/mona.kapur/blog/2008/01/14/process-chain-errors
    Common Process chain errors
    process chain issues or errors
    Hope this helps.
    Thanks,
    JituK

  • I create a playlist with songs that I purchased from itunes and when I try to sync it to my iphone some of the songs are missing but when I go to the playlist in itunes the song is there.  What could be happening?  What am I doing wrong?

    I've created playlists with songs I've purchased from iTunes and also added songs I've purchased from iTunes to existing playlists.  Everytime I go to sync the playlist to my iPhone I find some of the new songs missing from the playlist.  I've deleted the playlist from the phone and reinstalled it.  I don't know what I"m doing wrong. Anyone have any idea what could be the problem?

    Wondering if you haven't been bitten by the new "feature" of iOS 5, as was my son. turingtest2 explained it very well in reply to my own query about "missing" songs in playlists.
    Here's that thread...
    https://discussions.apple.com/message/16903613#16903613

  • Iphone 5s, Can't easily send sms. already updated in ios 7.1, What could be the possible reason and solution?

    I got my iphone 5s last 2 months, and it's ios is 7.0.6, after a month i can't easily send SMS, i have several apps and games. I tried to update my ios but still the problem persist. What could be the possible reason and what are the solutions? Please help me. 

    Technoboy14 wrote:
    I got my iphone 5s last 2 months, and it's ios is 7.0.6, after a month i can't easily send SMS, i have several apps and games. I tried to update my ios but still the problem persist. What could be the possible reason and what are the solutions? Please help me. 
    What does "can't easily send SMS" mean? What problems are you having with SMS? Without details, no one could possibly give you a reason or solutions.
    Have you tried resetting your device by pressing and holding the Home button and power button until the silver apple appears?

  • I have an IPad 2 and an Iphone4, but as it suggests that I can click a photo on my iPhone and the image will also reflect simultaneously on my IPad does not happen, though I have activated cloud on my iPhone. What could be the problem.???

    I have an IPad 2 and an Iphone4, but as it suggests that I can click a photo on my iPhone and the image will also reflect simultaneously on my IPad does not happen, though I have activated cloud on my iPhone. What could be the problem.???
    Also in my iPhone4 the photos that I have downloaded manually from my computer cannot be erased from the phone, how do i do this.???

    Sounds like you are not running iOS 5 ..........
    Update your iPad 2 to iOS 5............
    I purchased an iPad 2 for my wife for Xmas and it did not come with iOS 5 so I had to update it......
    http://www.apple.com/icloud/get-started/
    http://support.apple.com/kb/HT4972

  • My DVD write comes up with an error -43. Never done that before. What could be the reason. Please help

    My DVD write comes up with an error -43. Never done that before. What could be the reason. Please help

    iDVD is not involved in the process at all.
    What you want to do is create a data disk on a DVD.  That's done by inserting a blank DVD disc in the optical drive, Option+drag the files you want to backup onto the disc icon on the desktop and then drag that icon to the Trash bin in the dock which turns into the Burn feature. 
    Try that (the Option+drag and see if you can get your files to burn.
    OT

  • I have two graphics workers on osx 8.  They are both complaining that their files are changing label colors on it own.  Any idea what could cause this?

    I have two graphics workers on osx 8.  They are both complaining that their files are changing label colors on it own.  Any idea what could cause this?

    and there were and have been problems with any two nvidia cards which was the main part of my question.
    To provie details try pasting all but serial number from system profile. Sorry but Mac Pro tells me nothing, not model, year, or what graphic card it came with or updated with.

  • Cannot install itunes 11.1.3 to my windows vista home premium 32-bit.  After it finishes the download that it verifies the file I get a message saying "this file cannot be downloaded". What could the problem be??? I uninstalled my itunes and tried again

    Cannot install itunes 11.1.3 to my windows vista home premium 32-bit.  After it finishes the download that it verifies the file I get a message saying "this file cannot be downloaded". What could the problem be??? I uninstalled my itunes and tried again and keep getting the same message.  Please help !

    See Troubleshooting issues with iTunes for Windows updates.
    For downloading issues see the further information area and use a different browser and/or the direct links.
    tt2

  • Hi, I m using an iPhone 4 and my yahoo push email was working just fine but for the last few days I am experiencing some problem that is the emails are not getting pushed , I have to manually fetch the mails. So what could be the reason for this....

    Hi, I m using an iPhone 4 and my yahoo push email was working just fine but for the last few days I am experiencing some problem that is the emails are not getting pushed , I have to manually fetch the mails. So what could be the reason for this.....I have set the email setting to "push" mode. Moreover I can't edit the mail server address ....current it's on Yahoo SMTP server

    Will it get rectified and restored...if so after how long. What could be the reason for such outage kindly share,  as I am facing real problem because of this...

  • We are a creative design studio, we need to use apple mac pro server , so we can make more than a different user to use at the same time doing different activities, on different screens, is it possible?what is the max. no. of users that can work efficient

    we are a creative design studio, we need to use apple mac pro server , so we can make more than a different user to use at the same time doing different activities, on different screens, is it possible?what is the max. no. of users that can work efficient.
    Appreciate your support and if possible , how to do this?

    If you want to work with Mac OS X, you need one computer per simultaneous user.
    What you are describing, " Multiple simultaneous logins to a single computer" is not avialable on a regular Mac of any description, unless you decide to use Unix tools instead of Mac OS X.
    Server will happily store files for many, many users and provide them to multiple (up to hundreds) of computers at "near hard Drive" speeds over Gigabit Ethernet. It can make the File Sharing part easy.

Maybe you are looking for