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 ?????
11-14-2004, 08:05 PM
mikeBarr81
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.
11-15-2004, 05:28 AM
ractoc
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.
11-15-2004, 12:13 PM
RPBLEA
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);