Problems with open and save

Hello everybody
I am doing a project to create text editor. I have JMenuItems for save, open new. I want to know how to save a file. I want to save only .txt files. I am able to pop up a dialog box, but when I press save it does nothing. I think I need the FileWriter part, but I am not sure how to use it. So if someone can help me how save just .txt files in my text editor that would be great.
I also want to know how can I filter the files to just .txt files when i open the file. When I hit open in my program, I am able to open a txt file specified in my code, but what I want is to select any txt file.
Thanks

to save a file you would do something like:
FileWriter fw = new FileWriter( fileName );
textComponent.write( fw );
fw.close();See the JFileChoose API for filtering files by extension. The API gives an example.

Similar Messages

  • Popup with open and save file option

    Hi,
    I have created a button on my page name as "Export File" and created a process and called on "EXPORT FILE" button. I am using utl file in this procedure and i want to download this file and file will be .ics file using for calendar.
    My page process code is
    begin
    pro_create_ical(:P6_START_DATE,:P6_END_DATE);
    end;when i click on export file button it should raise a popup with open and save file option.
    How i can do this?
    Thanks & Regards
    Vedant
    Edited by: Vedant on Jan 25, 2013 1:59 AM
    Edited by: Vedant on Jan 25, 2013 2:00 AM
    Edited by: Vedant on Jan 25, 2013 3:49 AM

    Shiv,
    Have you installed any new Software/Spyware/Virus Scanner etc.Check it out.It might have caused the issue for last 5 days.
    This issue is fixed in Latest Support Package Versions.
    Which Version of Support Package you are using?
    If EP6 <SP19 you will face this issue.
    Just upgrade it to EP6, Support Pack-19,this will be resolved.
    Upgrade of Support Pack wont take much time.you can get the document under http://service.sap.com/instguides
    Hope it helps
    Regards,
    Karthick Eswaran
    *Reward Points for helpful answers.

  • Having a problem with "open" and "import" buttons!

    Hello all,
    I am having some trouble with a basic function in Logic. When I go to "file" and select "import," the window of options appears. However, when I select a file and click the "import" button, literally nothing happens. I have had a similar problem, when I go to the "file" menu and select "open." A window will appear for me to browse to the logic file I want to open, but when I click "open," nothing happens. However, if I manually go to the file and double-click it, then the file will open. The drop-down is set to "All logic document types," though I have tried "all Logic songs" with the same problem. Please help!
    Best,
    Jon

    you know whats funny, this project has to do with arrays of objects and not inheritance. We learned inheritance last week but the lab we are doing which is this, is for arrays of objects. sorry for the confusion lol. so you can completely ignore this, it actually has it in big bold letters at the top of the web page for the lab.

  • Problem with opening and closing windows

    Hi,
    I have a Flex Desktop Application with a Splash screen that
    displays for 5 seconds which is the initial WindowedApplication
    which uses script to centre itself in the screen at 400 x 300.
    It then loads and opens up a Window where people login and
    closes the splash screen (using NativeWindow.close) - the login
    window it opens is again 400 x 300 and centred on the screen.
    When the user susccessfully logins in, the login window needs
    to load and open a Window called MainWindow which is when my
    software will actually begin - this MainWindow needs to be
    maximised so I have a script inside it that does this
    (NativeWindow.maximise). The login window also needs to close and
    this is where my problem lies. I keep getting a problem when I use
    NativeWindow.close in the login window and then open the MainWindow
    and run the NativeWindow.maximise.
    Any suggestions or ideas on how I can do this better? This is
    my first Flex application and I'm just a beginner.
    I can send the Flex archive if required.

    Hi,
    Please check out the URLs below.
    http://www.adobe.com/devnet/air/flex/quickstart/creating_transparent_window.html
    http://www.adobe.com/devnet/air/flex/quickstart/launching_windows.html
    http://www.adobe.com/devnet/air/flex/quickstart/
    Hope this helps.

  • Problem with opening and closing the lid

    when i am trying to open or close the notebook lid..there is sound of crack, there is no any physical damage happened  in  past with my notebook....

    Hello Paresh9023
    Welcome to the HP Forums!
    I understand there is a sound coming from your notebook when you close it. Whenever something like this occurs, you should contact HP support immediately for assistance. You can utilize this website to learn how to contact HP appropriately, based on your region: Contact HP Worldwide
    Please let me know if you have any other questions or concerns. Thanks!
    Mario 
    I worked on behalf of HP.

  • How to Open and Save files

    I have a problem to open and save the files.here is my code. can anyone help me to open the files.
    public void actionPerformed(ActionEvent e) {
    if ("open".equals(e.getActionCommand())) {
    FileDialog fdopen=new FileDialog(this, "Load File", FileDialog.LOAD);
    fdopen.show();
    Thanks for ur time

    Hi fbnmir or who ever can answer my question,
    My problem is similar to the code you wrote. I'm trying to make (or rather complete a half done) editor for text files. For opening and saving files I have so far:
    public void actionPerformed(ActionEvent ae){
    FileDialog filedialog;
    final SearchDialog searchDialog;
    String arg = (String)ae.getActionCommand();
    // the Open ... case
    if(arg.equals(Editor.fileLabels[0])){ 
    if(Editor.VERBOSE)
    System.err.println(Editor.fileLabels[0] +
                        " has been selected");
    filedialog = new FileDialog(editor, "Open File Dialog", FileDialog.LOAD);
    filedialog.show();
    if(Editor.VERBOSE){  
    System.err.println("Exited filedialog.setVisible(true);");
    System.err.println("Open file = " + filedialog.getFile());
    System.err.println("Open directory = " + filedialog.getDirectory());
    //the Save ... case
    if(arg.equals(Editor.fileLabels[1])){ 
    if(Editor.VERBOSE)
    System.err.println(Editor.fileLabels[1] + " has been selected");
    filedialog = new FileDialog(editor, "Save File Dialog", FileDialog.SAVE);
    filedialog.show();
    if(Editor.VERBOSE){ 
    System.err.println("Exited filedialog.setVisible(true);");
    System.err.println("Save file = " + filedialog.getFile());
    System.err.println("Save directory = " + filedialog.getDirectory());
    These are two components of a MenuHandler class. The problem with this code is that in the text editor window, even if the Open button is pressed the file I want to open isn't displayed. Although the System.err (I think that's what it is called) says:
    Open ... has been selected
    Exited filedialog.setVisible(true);
    Open file = tutorial_01.rtf
    Open directory = C:\dhruba\epgy_2006\tutorial\
    Save ... has been selected
    Exited filedialog.setVisible(true);
    Save file = test.txt
    Save directory = C:\dhruba\epgy_2006\tutorial\
    How can I actually display the file I want to open, or save some text I've written?
    I would appreciate any help, thanks.

  • How can I use Automator to open and save Word docs with links?

    Hi-
    I'm having trouble building a Workflow to open and save Word docs with links.
    My Workflow so far:
    1. Get Finder items
    2. Copy Finder items (to new folder)
    3. Rename selected items
    4. Open selected items (Word docs)
    Three problems occur.
    The first is a Word 2004 problem -- I can't get the warning "This document has links in it; do you want to open it with/without updating the links" to go away (Unilke the Macro warning toggle capability, there is nothing in the Preferences for Word 2004 that addresses the links warning, as far as I can tell; any insight you can shed on this would be terrific.)
    The second problem happens with Automator: if I manually accept the update of the first document's links, Automator opens that document but then halts completely, even though I've instructed it to open multiple documents.
    The third problem I have is that there's no Finder action in Automator that allows me to save the document that's now open (as far as I can see).
    Any suggestions for how to fix? If I can get this to work, and scheduled in iCal, it will be an unbelievable time saver.
    Thanks,
    Jeremy
    PowerPC G5   Mac OS X (10.4.6)  

    Hi there Jeremy,
    to do this you are going to have to add in some Run AppleScript steps...
    These will rely on GUI Scripting. So first you need to activate GUI Scripting.
    Now we need to add in a Run AppleScript action to the end of your workflow...
    This will replace your current number 4 in the workflow (Open Selected...)
    click here to open this script in your editor<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">on run {input, parameters}
    set allItems to every item of input
    repeat with currItem in allItems
    tell application "TextWrangler"
    open currItem
    end tell
    activate application "TextWrangler"
    tell application "System Events"
    tell process "TextWrangler"
    delay 2
    --when the Word document is opened I have told it to press okay !
    --I don't know what key you want it to press in the dialog box
    keystroke return
    delay 2
    --save the doc
    keystroke "s" using command down
    delay 5
    --close the doc
    keystroke "w" using command down
    end tell
    end tell
    end repeat
    return input
    end run</pre>
    The above script should open each Word Document, press a button in the dialog box then do a save and then close the doc...then loop through the rest of them.
    You need to replace the name Text Wrangler with Microsoft Word (or whatever it is called!), I don't have it on my Mac.
    You will have to let me know what button needs pressing in the first dialog, if it isn't the 'highlighted ' one then we will have to amend the script...
    regards
    Ric

  • Is anyone experiencing problems with opening mission control from the desktop.  Running mountain lion with parallels 7 and windows 7

    is anyone experiencing problems with opening mission control from the desktop.  Running mountain lion with parallels 7 and windows 7

    I had been having a similar problem on Lion with Safari pdf files despite downloading the latest Adobe Reader XI.
    I would constantly get the same messages - There was an error opening this document. The file is damaged and could not be repaired. And I would get a blank page when I tried to print the pdf if I tried printing from the Safari web page using File - Print from the top toolbar on my laptop.
    Then I came across the grey Safari lozenge with action icons.
    This allowed me, without downloading the pdf, to print the pdf file direct from the Safari page by using the Print icon on the grey lozenge that appears centrally three quarters down the screen.
    Then I discovered that if I save the pdf using the Save icon from this same grey lozenge on the Safari page I can open and print this pdf version from my desktop.
    I've tested it with a couple of different pdf files and these methods work using the grey lozenge icons but the same pdfs files don't work using File - Save As on the Tool Bar.

  • Problem with Facebook and instagram after istalling iOS 7.1. Can not open them!

    Problem with Facebook and instagram after istalling iOS 7.1. Can not open them!

    Hi Hanjon!
    Here is an article that will help you troubleshoot these purchased apps:
    iOS: An app you installed unexpectedly quits, stops responding, or won’t open
    http://support.apple.com/kb/ts1702
    Thanks for being a part of the Apple Support Communities!
    Regards,
    Braden

  • I am not able to download ITunes. I had some problems with ITunes and had to uninstall but now when I reinstall iTunes after I click on download iTunes and save the File, I get this message"Thank you for downloading iTunes" and nothing else happens. I don

    I had some problems with ITunes and had to uninstall but now when I reinstall iTunes after I click on download iTunes and save the File, I get this message"Thank you for downloading iTunes" and nothing else happens. I don't see any thing else. Now not sure what else I have to do.
    Thanks,
    Ranjit

    See the further information area of Troubleshooting issues with iTunes for Windows updates.
    tt2

  • I'm having problems with FlashPlayerPlugin and plugin-container. They keep starting up and bogging down the system. This has been a recent occurrance. I've made sure that I have the latest version. I notice the problem when I am opening some applicatio, a

    I'm having problems with FlashPlayerPlugin and plugin-container. They keep starting up and bogging down the system. This has been a recent occurrance. I've made sure that I have the latest version. I notice the problem when I am opening some applicatio, and it freezes. If I go to Task Manager, I can see the two Adobe apps sucking up CPU cycles. If I end the processes, then the other apps continue. Today, I uninstalled FlashPlayerPluginqand plugin-container. All day since I have had no freezing of an app. What should I do to correct the problem?

    Here's an explanation of what those processes are. 
    Inside Flash Player Protected Mode for Firefox
    I'm curious about what you did to uninstall just those.

  • Slow open and save with psb files Photoshop CC

    Here is my system info:
    Mac Pro Early 2009
    Processor  2.66 GHz Quad-Core Intel Xeon
    Memory  32 GB 1066 MHz DDR3 ECC
    Graphics  ATI Radeon HD 5770 1024 MB
    Software  OS X 10.8.4 (12E55)
    Running Photoshop off an SSD 220GB as my bootdisk , and then my scratches are two 1TB Western Digi Caviar Blacks, both at about 60% full, running Big and flat in PS CC prefs,
    Running Photoshop CC 14.0.0
    I'm having very slow open and save times for psb files ranging in size from 2GB to 6GB - slow meaning 5-6 mins
    Does anyone have any suggestions to improve this time?

    I've noticed the same thing with .tif files. It's taking a good minitue or more to save a 15 meg .tif. Very annoying. I opened PS4 and converted the same .jpg to a .tif and saved it in the same location and it took about 4 seconds. Something is totally jacked with saving files in CC.
    Checked the compression settings and the are the same in both. Not a big fan of CC everything is slower. I pay monthly now to work slower?!? May have to go back to CS4.

  • I recently upgraded to Lion, and immediately started having consistent problems with Open Office 12 (would hang, and need a Force quit to recover). Has anybody else seen these problems? Any solutions other than going back to Snow Leopard? (I did).

    I recently upgraded to Lion, and immediately started having consistent problems with Open Office 12 (would hang, and need a Force quit to recover). Has anybody else seen these problems? Any solutions other than going back to Snow Leopard? (I did). But I'd like to use iCloud with iPad.

    Hi Pete. The repair of disk permissions can help resolve  any application crashing or misbehaving.
    As for Lion and the two camps, I think that is a reasonable observation. In my office we have about a dozen Mac's and about one third of those Mac's had problems after updating from 10.6 to 10.7. The main problem for these Mac's was a loss of wifi stability. But for the other two-thirds, Lion was a smooth transition.
    Personally, my Lion experience was fine. But I did get a new i7 MacBook Pro with Lion already installed and only had to migrate my user data from a 10.6.8 TM backup.
    So I think that is a key for Lion's operational success. A clean install of Lion on a new Mac would not cause too many operational issues. But an installation, or more correctly, an update to Lion from SL increased the chances of failure for some users - especially when old software & plugins resided on the Mac. And I would say that they were the people that you saw at the Apple store.
    As for the "latest release of Lion fixed my problems" statement, my experience with these and other forums is that people mostly only go there to complain about the problems they are having. If they are having no problems then they either keep it to themselves or they try to help the users who are experiencing trouble...

  • Files in all programs slow to open and save with Snow Leopard

    Installed Snow Leopard, now all files in all programs super slow to open and save - Photoshop, Illustrator, Quark -- all now at least 4-5X slower to open files and save -- here's what I've tried so far:
    repaired permissions
    emptied font cache - restarted up in safe mode
    re installed Snow Leopard
    renamed old preferences and restarted to create new prefs
    I'm hating Snow Leopard -- eeesh -- this is no upgrade, just a big waste of time and money, any ideas?

    See:
    Mac Maintenance Quick Assist,
    Mac OS X speed FAQ,
    Speeding up Macs,
    Macintosh OS X Routine Maintenance
    Essential Mac Maintenance: Get set up,
    Essential Mac Maintenance: Rev up your routines,
    Maintaining OS X, and
    Myths of required versus not required maintenance for Mac OS X for information.

  • [SOLVED]Problem with packettracer and firefox

    Hi
    I've got a problem with firefox and packettracer.
    When i click on pka file in firefox, it don't open this file in packettracer but wants to save on disk. I've got a version 5.3.1-1 packettracer and latest version firefox.
    I don't know when problem was occured but last week everything was ok. I think that's either update. Meyby it's important that when i type in console:
    update-desktop-database /usr/share/mime
    i've got such errors:
    Unknown media type in type 'all/all'
    Unknown media type in type 'all/allfiles'
    Unknown media type in type 'uri/mms'
    Unknown media type in type 'uri/mmst'
    Unknown media type in type 'uri/mmsu'
    Unknown media type in type 'uri/pnm'
    Unknown media type in type 'uri/rtspt'
    Unknown media type in type 'uri/rtspu'
    Unknown media type in type 'fonts/package'
    Unknown media type in type 'interface/x-winamp-skin'
    i have installed kde 4.5.5-1
    Do you know some solution for my problem?
    edit: update firefox solve my problem
    Last edited by ElNinijo (2013-06-08 08:35:12)

    I've had this happen now and again. You can rebind the lease yourself with:
    $ dhcpcd --rebind
    You could also try increasing the timeout by adding
    TimeoutDHCP=
    to your netctl profile/s - see netctl.profile(5) as WonderWoofy suggests. Although I haven't tried the latter.
    Last edited by youngdm (2013-09-01 22:01:05)

Maybe you are looking for