FileDocCategorySizeDatePackage
TestWrite.javaAPI DocExample903Sat Apr 23 22:35:42 BST 2005None

TestWrite

public class TestWrite extends JApplet implements ActionListener

Fields Summary
JTextArea
ta
Constructors Summary
Methods Summary
public voidactionPerformed(java.awt.event.ActionEvent e)

		try {
			String fname = "." + File.separator + "testwrite.xxx";
			write("Attempting to write file: "+fname);
			FileOutputStream file = new FileOutputStream( fname );
			new PrintStream( file ).println("Hello...");
			file.close();
			write("Success!");
		} catch ( Exception e2 ) {
			write( "Caught Exception: " + e2 );
			write("Failed to write file...");
		}
	
public voidinit()


	   
		JButton button = new JButton("Test Write");
		button.addActionListener( this );
		JPanel p = new JPanel();
		p.add( button );
		getContentPane().add( "North", p );
		getContentPane().add( "Center", new JScrollPane(ta) );
	
private voidwrite(java.lang.String s)

		ta.append( s + "\n" );