Methods Summary |
---|
public void | actionPerformed(java.awt.event.ActionEvent e)
String command = e.getActionCommand();
if ( command.equals("Quit") )
dispose();
else if ( command.equals("Load") )
loadFile();
else if ( command.equals("Save") )
saveFile();
|
private void | loadFile()
FileDialog fd = new FileDialog( this, "Load File", FileDialog.LOAD );
fd.show();
String file = fd.getFile();
if ( file == null ) // Cancel
return;
try {
FileInputStream fis = new FileInputStream ( fd.getFile() );
byte [] data = new byte [ fis.available() ];
fis.read( data );
textArea.setText( new String( data ) );
} catch ( IOException e ) {
textArea.setText( "Could not load file..." );
}
|
public static void | main(java.lang.String[] s)
new Editor().show();
|
private java.awt.MenuItem | makeMenuItem(java.lang.String name)
MenuItem m = new MenuItem( name );
m.addActionListener( this );
return m;
|
private void | saveFile()
FileDialog fd = new FileDialog( this, "Save File", FileDialog.SAVE );
fd.show();
// Save file data...
|