Problem with saving text areas

I'm trying to use the FileDialog() class to save a file but I'm having a few problems - I'm only really familiar with it to open files not save them - I have the following code.
save = new JButton("Save");
      save.addActionListener(
      new ActionListener()
    public void actionPerformed(ActionEvent evt)
      String saveName;
      saveNameBox = new FileDialog(frame,"Save File", FileDialog.SAVE);
      saveNameBox.show();
      //display the name
      saveName = saveNameBox.getDirectory()+File.separator+saveNameBox.getFile();
       try
        saveFile = new PrintWriter( new FileWriter(output.getText()));
      catch (IOException e)
        System.err.println("Error in file" + saveName + "; " + e.toString());
        System.exit(1);
[\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

new FileWriter("abc") creates a FileWriter that will write to the specified file (abc). You have got the filename mixed up with the text you want to write to the file.
You must then write the text after you have created the FileWriter.
try replacing
saveFile = new PrintWriter( new FileWriter(output.getText()));
with
saveFile = new PrintWriter(new FileWriter(saveName));
saveFile.print(output.getText());
saveFile.close();

Similar Messages

  • Problem with adding text area in scroll pane

    hi , i have been facing this funny problem , but cant able to get solution.
    the problem is i am trying to add text area in scroll pane , but when i add textarea in scroll pane using scrollpane.add(textarea) that text area remain disable always. i tried making it enable explicility but that code is not working.

    You don't use the add(...) method for JScrollPane. Use:
    a) new JScrollPane( textArea );
    b) scrollPane.getViewport().setView( textArea );

  • Problems with importing text messages from PC Suit...

    Problems with importing text messages from PC Suit 7.1.18.0 to my Nokia 5800
     I am trying to import a csv file that contains text messages (Note that this file was created using PC Suit 7.1.18.0) to a subfolder that I have created to My Folders but PC Suits only imports the text messages to the Draft folder. Note that initially it shows that the messages are import in the correct folder but after a refresh it shows them in the Draft Folder. Is their any setting that I should change in the PC Suit or the phone? My computer runs on Windows XP Service Pack 3 and the Nokia 5800 was upgraded to the latest firmware v20.0.012
     Thanks for your help

    Most phones only allows importing of draft and archived box for SMS.
    To do a restoring, you need to backup the SMS as a .nbu file using PC Suite and restore later.
    If you got an SD card, you can also do a backup on the SD Card (backup.arc) then restore later (reset and restore: backup.arc and mmc).
    What's the law of the jungle?

  • Problem with selecting text in Adobe Reader XI

    Hi all, I am encountering a problem with Adobe Reader XI and it is very strange I could not find an alike issue on the internet so I guess I have to submit a question with it.
    So here it is, I am using Adobe Reader XI Version 11.0.2, operating system: Windows 7. I do not know it starts from when but it has the problem with selecting text - to be copied in pdf documents. I ensure that the documents are not scanned documents but word-based documents (or whatever you call it, sorry I cannot think of a proper name for it).
    Normally, you will select the text/paragraph you want to copy and the text/paragraph will be highlighted, but the problem in this case that I cannot select the text/paragraph, the blinking pointer (| <-- blinking pointer) will just stays at the same location so I cannot select/highlight anything to be copied. It happens oftenly, not all the time but 90%.
    This is very annoying as my work involves very much with copying text from pdf documents, I have to close the pdf file and then open it again so I can select the text but then after the first copying or second (if I am lucky), the problem happens again. For a few text I have to type it myself, for a paragraph I have to close all opening pdf documents and open again so I could select the paragraph to copy. I ran out of my patience for this, it causes trouble and extra time for me just to copying those texts from pdf documents. Does this problem happen to anyone and do you have a solution for this? I would much appreciate if you could help me out, thank you!

    Yeah,  I totally agree, this is very strange. I have always been using Adobe Reader but this problem only occurred ~three months ago. It must be that some software newly installed I think. But I have no idea.
    About your additional question, after selecting the texts and Ctrl + C, the texts are copied and nothing strange happens. It's just that right after I managed to copy the texts, it takes me a while to be able to select the texts again. For your information, I just tested to select the texts and then pressed Ctrl, the problem happened. And then I tried pressing C and then others letters, it all led to the problem.
    I guess I have to stick with left-clicked + Copy until I/someone figure the source of this problem. Thanks a lot for your help!

  • Problem with append += text in Text Field

    Hi guys
    i have a problem with append text.
    I have one array which contain some city names, like CityArea=["NAME 1", "NAME2" ...etc];
    Then i have one String and one Text Field.
    Using for loop im getting right results. But when im running script again then im getting  same text again.
    F.ex.
    First time:
    City name: Name 1
    City name: Name 2
    Second time:
    City name: Name 1
    City name: Name 2
    City name: Name 1
    City name: Name 2
    I have tried to make TextField to and String to Null and delete it, but it's appearing again.. :/
    How to avoid this?
    Here is script:
    for (var i1:int = 0; i1 < CityArea.length; i1++)
      _CityAreaString1 += "<P ALIGN='LEFT'><FONT FACE='Verdana' SIZE='32' COLOR='#ffffff'>        "+CityArea[i1]+"</FONT></P>";
      _CityAreaString1 += "<P ALIGN='LEFT'><FONT FACE='Verdana' SIZE='5' COLOR='#ffffff'><BR></FONT></P>";
    _CityAreaTF1 = new TextField();
      _CityAreaTF1.border = true;
      _CityAreaTF1.wordWrap = true;
      _CityAreaTF1.multiline = true;
      _CityAreaTF1.selectable = false;
      _CityAreaTF1.antiAliasType = AntiAliasType.ADVANCED;
      _CityAreaTF1.name = "CityAreaTF1";
      _CityAreaTF1.embedFonts = true;
      _CityAreaTF1.htmlText = _CityAreaString1.toUpperCase();

    I think i found why.
    There was no problem with TextField.
    There was a problem with Array. "CityArea"
    So each time I executed script it added new string in Array. And that is because i got like:
    TextField
    City 1
    City 2
    City 1
    City 2
    Running this script is Ok:
    for (var i1:int = 0; i1 < CityArea.length; i1++)
      _CityAreaString1 += "<P ALIGN='LEFT'><FONT FACE='Verdana' SIZE='32' COLOR='#ffffff'>        "+CityArea[i1]+"</FONT></P>";
      _CityAreaString1 += "<P ALIGN='LEFT'><FONT FACE='Verdana' SIZE='5' COLOR='#ffffff'><BR></FONT></P>";
    But outside of this for loop there is another for loop for adding Cities in CityArray.
    I fixed it by adding empty array at the start of function
    function myFunc():void
    CityArea = [ ]; // Empty array fixed this issue
    // LOOP FOR ADDING SHOPS IN CITY AREA
    for (var j:int = 0; j < _Shops; j++)
    CityArea.push(_Shop);
    // FOR LOOP TO ADDING SHOPS IN STRING
    for (var i1:int = 0; i1 < CityArea.length; i1++)
      _CityAreaString1 += "<P ALIGN='LEFT'><FONT FACE='Verdana' SIZE='32' COLOR='#ffffff'>        "+CityArea[i1]+"</FONT></P>";
      _CityAreaString1 += "<P ALIGN='LEFT'><FONT FACE='Verdana' SIZE='5' COLOR='#ffffff'><BR></FONT></P>";
    Thank you for your help kglad

  • Problem with sending text messages replies

    After update to OS 3.0 I have problem with sending text messages:
    - I CAN send new text message to someone but
    - When someone REPLY me, then I CANNOT send next message in conversation
    - If I DELETE someone's reply from that conversation text message sends fine.
    Anyone have this problem? I have iPhone 3g with OS 3.0 update, previously on 2.x the problem didn't appear. Carrier Orange in Poland

    no my girlfriend, was useing my old N75, now she is useing her old phone last night and today. we have been texting with no problems at all. ..so i'm back in the iphone, and we're going to get her a new phone tonight,or she's going to use one of my other back-up phones till we get one for her. called at&t today to see if she could get an early upgrade before oct. just to make me happy with all the BS i've been through (10 hours or more on the phone trying to fix the problem). but at&t came through with their great customer satisfaction!!! NOT!!! so, gonna try and get her a good phone out of contract and see after hers and mine are up might just jump from at&t. very unhappy with them as how they handled this whole thing.

  • Premiere Elements 13 , Problems with new text/titles

    Premiere Elements 13, bisher keine Probleme. Nachdem die Filmlänge etwa 15 Minuten beträgt immer größere Probleme Titel/texte einzugeben. Wartezeiten sind extrem lange oder Programm stürzt ganz ab.

    High ATR,
    Computer running on Widows 7 ,64 Bit System, Service Pack 1, Processor AMD Phenom(tm) X4 945 3.00 Ghz;RAM 8 GB
    Grafikkarte: NVIDIA GeForce 8800 GT
    If the video on the timeline is longer than 10 minutes the problem will be remarkable. The response times adding a title is getting longer(2-15 seconds).
    As the video is now 18 minutes the response time is after each action(resizing of letters or any changes of the text) up to 30 seconds or the program crashes completely.
    Project settings are the following:
    General HD 1080i; 29,97frames/second; Video:1920v 1080 H, 30 fps
    Video: maximale Bittiefe, Dateiformat i-frame only mpeg, Kompressor MPRG i-Frame, Standbilder optimieren
    The video is a mixture  of full HD videos 1920x 1080 .mov and pictures up to 4608x3456 pixels.
    When the program crashes I remarked that the main memory RAM(8Gb) was fully used by the premiere program. Might there be a problem?
    Thank you for your service.
    thomasd
    Von: A.T. Romano 
    Gesendet: Sonntag, 1. Februar 2015 23:55
    An: Thomas Deschler
    Betreff:  Premiere Elements 13 , Problems with new text/titles
    Premiere Elements 13 , Problems with new text/titles
    created by A.T. Romano <https://forums.adobe.com/people/A.T.+Romano>  in Premiere Elements - View the full discussion <https://forums.adobe.com/message/7151822#7151822>

  • Problems with recieving texts?

    I am having problems with recieving text messsages, today I only had 2 hours that I recieved text messages. This has happened a few times, and when I take my phone to the verizon store they say there is no problem. Has anyone else had this problem?

    hoovie,
    I'm sorry to learn you are having issues with your text messaging. Just so I know I am up to speed, are you getting messages delivered to your phone on a 2 hour delay or do you have only a 2 hour window where you can receive any messages? Does this happen with only specific persons? Are you having any trouble sending text messages throughout the day?
    Please advise more information so I can help further.
    Thanks
    AdamE_VZW
    Follow us on Twitter @VZWSupport

  • Problem with saving a pdf file to computer. Continually get an error message " This document could not be saved. There was a problem reading this document (21).

    Need advice on a saving file issue. I'm having problem with saving a .pdf file to computer. Continually get an error message " This document could not be saved. There was a problem reading this document (21). This is new as this error message just recently started to pop-up.

    More information about this issue can be found here:
    https://forums.adobe.com/thread/1672655
    A "quick" fix that worked for me was to uninstall Adobe... then download the base install for Adobe Reader 11.0.
    Then download each of the individual updates and run them sequentially. 
    I've installed back up to the last security update which is version 08 and have been able to do normal Save As operations.
    You will have to disable automatic updates in order to stay at version 08 until Adobe resolves this issue in a later release.
    http://www.adobe.com/support/downloads/product.jsp?product=10&platform=Windows
    Adobe Reader 11.0 - Multilingual (MUI) installer    AdbeRdr11000_mui_Std
    Adobe Reader 11.0.01 update - Multilingual (MUI) installer    AdbeRdrUpd11001_MUI.msp
    Adobe Reader 11.0.02 update - All languages    AdbeRdrSecUpd11002.msp
    Adobe Reader 11.0.03 update - Multilingual (MUI) installer    AdbeRdrUpd11003_MUI.msp
    Adobe Reader 11.0.04 update - Multilingual (MUI) installer    AdbeRdrUpd11004_MUI.msp
    Adobe Reader 11.0.05 security update - All languages    AdbeRdrSecUpd11005.msp
    Adobe Reader 11.0.06 update - Multilingual (MUI) installer    AdbeRdrUpd11006_MUI.msp
    Adobe Reader 11.0.07 update - Multilingual (MUI) installer    AdbeRdrUpd11007_MUI.msp
    Adobe Reader 11.0.08 security update - All languages    AdbeRdrSecUpd11008.msp

  • A problem with copying text from english pdf to a word file

    i have a problem with copying text from english pdf to a word file. the english text of pdf turns to be unknown signs when i copy them to word file .
    i illustrated what i mean in the picture i attached . note that i have adobe acrobat reader 9 . so please help cause i need to copy text to translate it .

    Is this an e-book? Does it allow for copying? It is possible that the pdf file is a scan of a book?

  • Problems with saving edited photos using Photoshop Elements 5.0 on WIndows 8.

    Since a week I can not save the edited photos - when I try the communicate: "Caould not complete your request because of a program error" appeares. I had no problem with saving edited photos before, with the same software. My computer runs on Windows 8, 64 bit version. My Photoshop Elements is version 5.0. Where is the problem?

    W dniu 2013-06-16 15:36, dj_paige pisze:
    >
    Yes, I did it long ago.

  • CS3 - Problem with dynamic text -

    Hello,
    I have a problems with my text, when i write a few ligne inside a dynamic text box, if i selec the text and by the way drag it down the first line goes up and disapear. Is there any way to solve this?

    This is the Flash Player forum; please post your question in the appropriate product forum.

  • Problem with "Saved with Id" in Reports

    Hi Group,
    I am having problem with "Saved with id" functionality.
    1.) I created a Query in sq01 as "query1".
    2.) Copied the source code of this query into a z program
    ztest_query.
    3.) Now executed the report "ztest_query" in background with "Saved with Id" checkbox checked and id as "1234".
    4.) Now where/how can I search for this id "1234" to retrieve my list.
    5.) Normally if I dont change the report name and use the program aq*query1 which is self generated one, this works and I am able to retrieve the saved list from Transaction
    SQ01.
    Please let me know how this can be achieved.
    Regards
    Ankur Bhandari

    Ankur,
    Did you find a solution for this problem. Not many seem to be using this "Save list to id" functionality.
    Thanks
    Vyas

  • Problem with the text from previous year in current year appraisal (PPR)

    Hi Gurus,
    I have some problem with the text from the PPR of the previous year in the PPR current year.
    The text from the previous year have not the same displaying in the tab "previous year" of  the current year PPR.
    EXAMPLE :
    this is write in the PPR of year 2009 in Individual Targets without Incentives (tab My S-imple) :
    -Aufrechterhaltung der MA motivation, in dieser Zeit der Neuorientierung.
    -G1 Unterstüzung
    -Fachübergreifende Teamarbeit ausbauen
    Gefährdungsbeurteilung weiter führen
    -tragen von PSA einfordern
    -VI Opt.(Intervalle)
    -Azubi und Praktikanten AUsbildung unterstüzen
    and this is what I have in the PPR of 2010 in Individual Targets without Incentives (tab Previous Year's Targets):
    -Aufrechterhaltung der MA motivation, in dieser Zeit der-Aufrechterhaltung der MA motivation, in dieser Zeit der
    -Aufrechterhaltung der MA motivation, in dieser Zeit der
    -Aufrechterhaltung der MA motivation, in dieser Zeit der
    -Aufrechterhaltung der MA motivation, in dieser Zeit der
    -Aufrechterhaltung der MA motivation, in dieser Zeit der
    -Aufrechterhaltung der MA motivation, in dieser Zeit der
    -Aufrechterhaltung der MA motivation, in dieser Zeit der
    there is the error, all the end of the text isn't displayed and the begin of the text is repeated.
    I think that this issue is created at the creation of the PPR.
    If someone have a idea he is welcom.
    thanks and regards

    Hi,
    Please follow the note:425601,
    Go to Tcode: OBA5 change the error messge into warning message. carry out the settlement and roll abck the warning message into the error message after sucessfull settlement.
    Reward points if found useful.
    Thanks!

  • Problems with saving a file

    Hello,
    Im having problems with saving files on my computer, from Mail and Safari. I have 900gb free diskspace, but i simply cant save anyhow, it says my disk is full.
    Have i accidentally locked something up?
    Regards,
    Niclas

    Run disk utility on your hard drive to repair your permissions.  http://support.apple.com/kb/HT1452

Maybe you are looking for

  • G50-30 System is unstable after BIOS upgrade

    After installing Windows 7 I decided to upgrade BIOS and picked the proposed update for Windows 7 64bit (http://support.lenovo.com/uu/en/products/laptops-and-netbooks/lenovo-g-series-laptops/g50-30-notebook-lenovo).  After applying the upgrade system

  • Photoshop Elements Menu Bar Troublehsooting

    Hey everyone, first time poster here. I have a question concerning a recurring problem that I'm having with Photoshop Elements 4.0's Menu Bar (File, Edit, etc.) I bought Elements 4.0 new in 2005 and have used it often since without upgrading because

  • How do I save video from iMessage?

    How do I save a video, that has been sent via text msg, on my MacBook pro? I have opened the file on my macbook pro through I message using quicktime but I cant figure out how to save the video. Help please:)

  • Use different Layouts for Summary and Details in Drill down report

    Hi All, I have a 2 level drill down report in ALV. The summary report has certain fields and the Detail report has different fields. Now my problem is that when i use a default layout (with all fields of summary report) for the summary report, and dr

  • Scanning through code

    hi I am trying to create a ZProgram A which will scan the code of another Z program B and check whether code standards are maintained in it or not. So for this I need to copy the source code of Z Program B into Z Program A's internal table. Can you h