Problem with Saving/Open
I need to get a simple word editor program I am making to save and load documents, but don't know how to really do this.
Here is what I have so far, (well just for this class), any advice on getting the Save or Open to work will greatly be appreciated
Thanks in advance
import java.awt.*;
import java.awt.event.*;
class EditorMenuHandlerimplements ActionListener, ItemListener{
private Editor editor;
protected EditorMenuHandler(Editor editor){ this.editor = editor;}
publicvoid 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());
}
}
//the Search ... case
if(arg.equals(Editor.fileLabels[2])){
if(Editor.VERBOSE)
System.err.println(Editor.fileLabels[2] +
" has been selected");
searchDialog =new SearchDialog(editor);
searchDialog.show();
if(Editor.VERBOSE)
System.err.println("searchDialog.show(); has exited");
}
//the Quit ... case
if(arg.equals(Editor.fileLabels[3])){
if(Editor.VERBOSE)
System.err.println(Editor.fileLabels[3] +
" has been selected");
System.exit(0);
}
//the Cut case
if(arg.equals(Editor.editLabels[0])){
if(Editor.VERBOSE)
System.err.println(Editor.editLabels[0] +
" has been selected");
}
//the Copy case
if(arg.equals(Editor.editLabels[1])){
if(Editor.VERBOSE)
System.err.println(Editor.editLabels[1] +
" has been selected");
}
//the Paste case
if(arg.equals(Editor.editLabels[2])){
if(Editor.VERBOSE)
System.err.println(Editor.editLabels[2] +
" has been selected");
}
}
/**
* This needs to be here since we need to implement the ItemListener
* interface
* @see java.awt.event.ItemListener
*/
publicvoid itemStateChanged(ItemEvent ie){
//shouldn't need to do anything here.
}
}

