aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes problem with actionEvent command Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "problem with actionEvent command" Watch "problem with actionEvent command" New topic
Author

problem with actionEvent command

Arun kumar Maalik
Greenhorn

Joined: Jul 04, 2006
Posts: 18
Respected sir in following code what is the problem with code it is compiling fine but when i m pressing on submit button it is throwing lot of exception although i think that exception is throwing at the time when i m creating file with command RandomAccessFile. pls solve the problem




import javax.swing.*;
import java.applet.*;
import java.awt.event.*;
import java.awt.*;
import java.io.*;
import java.util.*;

/*<applet code="first1.class" height=400 width=400> </applet> */

public class first1 extends JApplet implements ActionListener{
Container con;

JLabel lbl1=new JLabel("Student name");
JLabel lbl2=new JLabel("Password");
JLabel lbl3=new JLabel("Course");
JLabel lbl4=new JLabel("Subject");

JTextField txt1=new JTextField();
JTextField txt2=new JTextField();
JTextField txt3=new JTextField();
JTextField txt4=new JTextField();

JButton btn=new JButton("Submit");

public void init(){
con=getContentPane();
con.setLayout(null);

lbl1.setBounds(30,30,90,40);
txt1.setBounds(120,40,90,20);
lbl2.setBounds(230,30,90,40);
txt2.setBounds(320,40,90,20);
lbl3.setBounds(30,60,90,40);
txt3.setBounds(120,70,90,20);
lbl4.setBounds(230,60,90,40);
txt4.setBounds(320,70,90,20);
btn.setBounds(200,100,90,30);

con.add(txt1);
con.add(txt2);
con.add(txt3);
con.add(txt4);

con.add(lbl1);
con.add(lbl2);
con.add(lbl3);
con.add(lbl4);

con.add(btn);

btn.addActionListener(this);


}

public void actionPerformed(ActionEvent ae){
String st1=txt1.getText();
String st2=txt2.getText();
String st3=txt3.getText();
String st4=txt4.getText();
String st=ae.getActionCommand();

try{



if("Submit".equals(st))
{
RandomAccessFile raf1=new RandomAccessFile("work.txt","rw");

}
}
catch(IOException ie){}
}


}
Sunil Kumar Gupta
Ranch Hand

Joined: Aug 26, 2005
Posts: 824
Can you put here the list of exceptions you are getting when run this applet.

So that we can give a better answer to your question.


Lack of will power has caused more failure than lack of intelligence or ability.
My Blog | Red5 Resources | Technology Update | Daily Technology Tips
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with actionEvent command