Save Command?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Save Command?

  1. #1
    Join Date
    Sep 2004
    Posts
    103

    Question Save Command?

    If I create a button in a Applet, Named "Save" for example. How do I save the applet that is shown to the user. How Do I save the Data in the APplet, I cannot figure this out, I've been given the option to use printwriter, But I have no idea even how to start to use the print writer function. I need some help, Can anyone give me examples of how a save button would work?

    I know code would be something that this for the button, Have no idea how to save though, Would I use action performed, Another Method, need some help, never have done this before. Thanks

    private int button = new button "Save";

    Add(button);

    add.actionListener(this);


    ActionPeformed method ?????

  2. #2
    Join Date
    Feb 2004
    Posts
    541
    Well if you were using an application it would be easy, but with applets I think there are security restrictions. You can't normally access the clients computer to read or write files.

  3. #3
    Join Date
    Oct 2004
    Posts
    311
    mike is right, from within an app[let, it is usually impossible top save data to the local machine (or access any other local resources). There is a way around this however, you'll need to sign your applet. I read somewhere on how that's done, but I can't remember the url. You should be able to find it on google though.

  4. #4
    Join Date
    Sep 2004
    Posts
    103

    I figured it out

    I figured it out guys, I just created a method named go, Then I created a fildialog box, and then figured out how to save it from there, and then just called method go in actionperformed with an if statement

    public void go2() {
    Frame window = new Frame();
    FileDialog df = new FileDialog(window,"Save",FileDialog.SAVE);
    df.setVisible(true);
    String fname = df.getFile();
    System.out.println("File is Saved: " + fil);

    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center