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.

Similar Messages

  • How to open and save file like the Notepad Demo do?

    I am a newer to Java Web Start. I found that in the Notepad Demo, when user try to open or save file, a message box appear and give the user some security suggestions.
    In my application, I used a JFileChooser and set the <security> element to <j2ee-application-client-permissions/> in the jnlp file. But the application will thow an exception:
    access denied (java.io.FilePermission C:\Documents and Settings\Administrator\desktop\Java Web Start.lnk read)
    Can someone tell me how to solve this problem. By the way, where can I find the source of the Notepad Demo. I want my application to open and save file just like the Notepad Demo do.

    The Notpad demo uses the JNLP api to read and write files. The api doc can be found at:
    http://java.sun.com/products/javawebstart/docs/javadoc/index.html
    Although the Notpad demo source is not available, there is other sample code available at:
    http://developer.java.sun.com/developer/releases/javawebstart/
    Included here is the webpad demo, which uses the FileOpenService and
    FileSaveService API's.

  • HOW TO OPEN AND SAVE FILES TO/FOR MS-WORD 2007 .docx format

    MS-Office 2007 will open .docx files as well as .doc files. Apple's Pages '08 can OPEN MS Word 2007 documents with the new file format ".docx". Pages '08 can not save as ".docx" files, just ".doc" files, but since MS Office 2007 can open these ".doc" without a problem, you should be covered.
    Here is how.
    To open: Just double click the file and Apple's Pages '08 will import the file and open it for you to use and modify.
    To save and use at your work or school's Windows MS Word 2007: When you are done and ready to save the file, go to FILE in the menu bar in Pages '08 and select EXPORT. Then pick the icon DOC WORD and click NEXT. Then in the SAVE AS box, give it a name and tell where you want to save your file to. Click EXPORT. Export is like Save, as it will now save the file where you told it to save it to. Remember you can use the same name, or give it a new name. Thats it. EASY.
    It will save the file in a Windows Word format of ".doc" that MS Word 2007 can open and use.
    Hope this helps people.
    -Apple //GS

    Why yes. How did you know that I saw the way, the truth and the light?
    I just had so many people ask me how to do this, that I thought I might share it with as many people as I could and help the masses To bad that Apple just did not have it as a simple "Save As:" Maybe in the next update.
    -Apple //GS

  • 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.

  • How to open a save file dialog box in form

    hi
    all
    I have prob in form desing , i have open the save file dialog box , how to open a save dialog box
    and path of the select file to save in disk
    help
    thx

    hi
    user this query when-button-pressed trigger
    :txtfile := GET_FILE_NAME(directory_name =>'d:\ali_raza\backup\', file_filter=> 'DMP Files (*.dmp)|*.dmp|');
    Rizwan

  • PS CC - Performance, open and save files

    Hi guys,
    I am working on multi-gigabyte files 4-10gb, but say a 5gb file takes me approx 75 seconds to open... it only use 4 core's and 10gb of ram.
    Saving is so sloow - same size files, now I haven't timed it but it takes time... IMHO it takes too much time considering the hardware.
    system contains 20 SSD's
    8x Samsung 830 Raid-0 for startup disk (Areca 1882ix-24 4GB cache)
    6x Intel 520 Scratch disk in Raid-0 IBM M1015 controller
    6x Intel 520 storage disk in Raid-0 IBM M1015 controller
    I have played with various configurations
    48GB of ram
    2x XEON X5650 at stock speed 2.66Ghz - but it can go to 4.2Ghz
    Windows 7 x64
    am I expecting too much?
    thanks
    Henrik

    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 to open and save pictures from 1 folder at the same time?

    Is there a way to open and save pictures from 1 folder at the same time?
    I'm creating a vi that resizes the picture but I want to do it with 1 folder at a time... Is this possible?
    greetings!

    Hi Kway,
    Here you are. I wrote a file a customer times ago & It did what you want!
    Just see the attachements and keep me inform.
    Regards,
    Julien Roland - District Sales Manager
    NI Belgium - Technical Support
    Don't forget to rate a good answer
    Attachments:
    Test existing Files.vi ‏23 KB
    Delete files from array of files (SubVI).vi ‏16 KB

  • Illustrator CC is taking a very long time to open and save files.

    I am using a Mac with the Mavericks OS. Illustrator can take up to FIVE MINUTES to open or save a file. It is becoming a waste of time as I have to work on multiple projects a day. I read about "Adobe Drive" but have not found this option on the version of Illustrator that I have.
    Please help!

    Any update?
    I found this discussion: http://forums.adobe.com/message/5839180 but have been unable to locate Adobe Drive on my system.
    I have followed the above suggestions with no avail. I have only been opening files from my desktop. This issue is only with Illustrator, Photoshop works fine.
    I ran a script yesterday that opens up eps files and saves them as a png, and what normally takes around 30 seconds took almost 45 minutes. I need to solve this problem asap.
    Would uninstalling and reinstalling the CC suite be of any benifit?

  • How to open and XML file?

    Does anyone have a way on Mac to open an XML file for viewing. This can be done with WIN Excel and XML toolkit but doesn't exist for Mac Excel in Office 2008. I can open with TextEdit but would like to see the info with headers and cells without all the XML coding. Numbers 09 can't open it at all.

    Numbers uses XML to build the description of the documents but it's not an XML editor.
    A simple search in Google with the intricate key string xml editor AND mac return numerous interesting links.
    Yvan KOENIG (VALLAURIS, France) vendredi 9 octobre 2009 11:33:27

  • How to open and save PDF from web?

    I can't see how to open a PDF in adobe from safari

    This should help:
    http://forums.adobe.com/docs/DOC-2532

  • How to fetch and save file in common server using FTP in SAP

    Dear All,
    My requirement is to fetch a image and save an image in a common server through SAP .
    I think there is some concept of doing the same using FTP.
    Please put some light on this issue.
    REgards,
    Amruta

    Hi,
    Below are the FM's use to FTP.
    FTP_CONNECT                    Connect to FTP server
    FTP_COMMAND                    Execute FTP Command
    FTP_DISCONNECT                 Disconnect from FTP server
    You can search SDN for more details on each of the FM's.
    Hope this helps
    Regards
    Shiva

  • AppleScript open and save file with Numbers

    Hi all,
    I need to save an Excel .xls file as an .xls file in order to break the links that are included in the original Excel file. Since Numbers doesn't have any actions for Automator, I hoped someone could help me writing an AppleScript?
    It needs to open (Numbers) and all the .xls files that are added to a specific folder on my Mac, then save them to another folder as .xls (not .xlsx) and overwrite any existing files with same name. Since this all should work automatically, warnings and pop-ups that need a user to click an option are not allowed.
    Didn't think this could be too hard, but I'm just a noob when it comes to AppleScript. Help?
    Thanks in advance

    Check the attributes of the <textarea> tag. You can use wrap="no" or wrap="virtual" or wrap="hard" to define how the text area handles carriage returns.
    Brian

  • How to open and close files from UIwindow my function doesn't work

    Hello guys!
    I am trying to create a simple ui-interface.
    I made one button so far.
    but my function does not work.
    if I run the function without dialog box it works perfectly!
    when I running the function in the dialog window, picking a file and open, nothing happens why?
    please help me with a correct code.
    also how do I write  2 functions that also closing a file and  saving a file?
    here is my simple code.
    var w = new Window ("dialog");
    button.onClick = function () {
    OpenMyFile();
    w.show ();
    function OpenMyFile(){
    var myFile = File.openDialog();
    app.open(myFile)
    Thank you in advance.

    Well, to answer your first question, you've added an event listener, but you haven't actually added the button itself.
    try this:
    var w = new Window ("dialog");
    b = w.add("button", undefined, "Click me!");
    b.onClick = function () {
    OpenMyFile();
    w.show ();
    function OpenMyFile(){
    var myFile = File.openDialog();
    app.open(myFile)

  • How to Open and a File

    Hi Friends.
    Now i have Created a New File and that By Using that File i Wrote Few Records from the DataBase into That file. Let us take CSV File, Ok, Now i want to Open this File Automatically and show the content to the User After The writing operation Done in the File. That is when all the records from the Database table has been wirtten into the CSV File this file should be Opened Automatically and shown to the User.
    Please give me some suggestion to do this
    Thank you for your service
    Cheers
    Jofin

    basic tools you need to read a CSV file are:
    - BufferedReader+FileReader, to read the file
    - StringTokenizer, to split the lines
    - Possibly a JTable if you want a matrix representation of the result

  • Slow to open and save files

    My Macbook Pro with Mac OS X 10.7.4 has been real slow lately in opening files, saving documents, opening webpages.  Any suggestions on ways to speed things up?  I often have MS Excel and Word and Outlook open so not sure if that is the problem.

    Please read this whole message before doing anything.
    This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.
    Step 1
    The purpose of this step is to determine whether the problem is localized to your user account.
    Enable guest logins* and log in as Guest. For instructions, launch the System Preferences application, select Help from the menu bar, and enter “Set up a guest account” (without the quotes) in the search box. Don't use the Safari-only Guest login created by Find My Mac.
    While logged in as Guest, you won’t have access to any of your personal files or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
    Test while logged in as Guest. Same problem(s)?
    After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
    *Note: If you’ve activated “Find My Mac” or FileVault in Mac OS X 10.7 or later, then you can’t enable the Guest account. The Guest login created by “Find My Mac” is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.
    Step 2
    The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode* and log in to the account with the problem. The instructions provided by Apple are as follows:
    Be sure your Mac is shut down.
    Press the power button.
    Immediately after you hear the startup tone, hold the Shift key. The Shift key should be held as soon as possible after the startup tone, but not before the tone.
    Release the Shift key when you see the gray Apple icon and the progress indicator (looks like a spinning gear).
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    *Note: If FileVault is enabled under Mac OS X 10.7 or later, or if a firmware password is set, you can’t boot in safe mode.
    Test while in safe mode. Same problem(s)?
    After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of steps 1 and 2.

Maybe you are looking for