hes the code

import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.*;

public class CreateEventFile extends Frame implements ActionListener, WindowListener
{
	private Label companyName = new Label("Event Handlers Incorporated");
	Font bigFont = new Font ("Helvetica", Font.ITALIC, 24);
	private Label prompt = new Label("Enter this month's events");
	private TextField host = new TextField(10);
	private TextField date = new TextField(4);
	private TextField guests = new TextField(4);

	private Label hLabel = new Label("Host");
	private Label dLabel = new Label("Date");
	private Label gLabel = new Label("Guests");

	private Button enterDataButton = new Button("Enter Data");

	DataOutputStream ostream;

	public CreateEventFile()
	{
		super("Create Event File");
		try
		{
			ostream = new DataOutputStream(new FileOutputStream("event.dat"));
		}
		catch(IOException e)
		{
			System.err.println("File not opened");
			System.exit(1);
		}
	setSize(350,20);
	setLayout(new FlowLayout());
	companyName.setFont(bigFont);
	add(prompt);
	add(hLabel);
	add(host);
	add(dLabel);
	add(date);
	add(gLabel);
	add(guests);
	add(enterDataButton);

	enterDataButton.addActionListener(this);
	setVisible(true);
	addWindowListener(this);

	}

	public void actionPerformed(ActionEvent e)
	{
		int numGuests;
		try
			{
				numGuests = Integer.parseInt(guests.getText());
				ostream.writeUTF(host.getText());
				ostream.writeUTF(date.getText());
				ostream.writeInt(numGuests);

				host.setText("");
				date.setText("");
				guests.setText("");

			}
		catch(IOException e2)
			{
				System.err.println("Invalid number of Guest");
			}
	}

	public void windowClosing(WindowEvent e)
	{
		try
			{
				ostream.close();
			}
		catch(IOException e2)
			{
				System.err.println("File not closed");
				System.exit(1);
			}
		System.exit(0);
	}

	public void windowClosed(WindowEvent e){}
	public void windowDeiconified(WindowEvent e){}
	public void windowIconified(WindowEvent e){}
	public void windowOpened(WindowEvent e){}
	public void windowActivated(WindowEvent e){}
	public void windowDeactivated(WindowEvent e){}
}

can someone give a link of examples of File Handling thats not applet. a JFrame is fine

whats the errors you get when compiling?

Dealing with File doesn't require UI in graphic. You need to understand how to read/write file. That's all. You can google for "java read write file" and there should be many example for how to read/write file in Java.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.