DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
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);

    }

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links