Using a JFileChooser to allow a user to select a fileTopReading and writing filesWriting applications instead of applets so our programs are allowed to manipulate files

Writing applications instead of applets so our programs are allowed to manipulate files

Applets that are run via a Web page are restricted in the kinds of actions they can take. In particular, applets are not allowed to read or write files. To work with files we need to write applications instead. There are only a few things we need to do differently:

Here are the relevant parts of the ShortWordsFixedFiles demo showing how to create an application.

public void createGUI() {
   JFrame frame = new JFrame();
   Container contentPane = frame.getContentPane();

   // Code to create the components is omitted

   frame.pack();
   frame.setVisible(true);
}

public static void main(String[] args) {
   new ShortWordsFixedFiles();
}

Using a JFileChooser to allow a user to select a fileTopReading and writing filesWriting applications instead of applets so our programs are allowed to manipulate files