public void actionPerformed(ActionEvent ae)
{
	if(ae.getSource()==clear)
	{
		tname.setText("");
		tpass.setText("");
	}
	else
	{
  		if(ae.getSource()==Admin)
     		{	
			try
			{
	 			a=tname.getText();
				b=tpass.getText();
				Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
				Connection con=DriverManager.getConnection("jdbc:odbc:vote");
				Statement st= con.createStatement();
				ResultSet rs;
				rs=st.executeQuery("select * from votelogin where tname='"+a+"'and tpass='"+b+"'");
   				while(rs.next())
				{
	 				aa=rs.getString(1);
 	 				bb=rs.getString(2);
				}
        			if(a.equals(aa)&& b.equals(bb))
	   			{
	  				JOptionPane.showMessageDialog(this,"INVALID USER.TRY AGAIN");
					System.out.println("invalid user");

	    			}
				else
				{
					JOptionPane.showMessageDialog(this,"VALID USER");
           				System.out.println("Valid User");
           				adminframe adf=new adminframe();
				}
			}
       
    			catch(Exception e)
     			{
      				System.out.println(e);
  			}
 }
        
}
}
public void actionPerformed(ActionEvent ae)
    {
	if(ae.getSource()==clear)
	{
		UName.setText("");
		PinNo.setText("");	{
  		if(ea.getSource()==user)
     		{	
			try
			{
	 			a=UName.getText();
				b=PinNO.getText();
				Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
				Connection con=DriverManager.getConnection("jdbc:odbc:vote");
				Statement st= con.createStatement();
				ResultSet rs;
				rs=st.executeQuery("select * from votelogin where UName='"+a+"'and PinNO='"+b+"'");
   				while(rs.next())
				{
	 				aa=rs.getString(1);
 	 				bb=rs.getString(2);
				}
        			if(a.equals(aa)&& b.equals(bb))
	   			{
	  				JOptionPane.showMessageDialog(this,"VALID USER");
           				System.out.println("Valid User");
           				userframe usf=new userframe();
	    			}
				else
				{
					JOptionPane.showMessageDialog(this,"INVALID USER.TRY AGAIN");
					System.out.println("invalid user");
				}
			}
       
    			catch(Exception e)
     			{
      				System.out.println(e);
  			}
		  }
                      else
   		 if(ea.getSource()==exit)
      		{
			System.exit(0);
		}      
 
   	}
	}
	}
  
public static void main(String ar[])
    {
	vote v=new vote();
	v.init();
    }
}

Recommended Answers

All 4 Replies

Uhm, where, exactly.

could you post the stacktrace

could you post the stacktrace

There isn't one. That is a compiler message.

If this exactly what you wrote in the java file then I think you defined actionPerformed method twice :

public void actionPerformed(ActionEvent ae)

This will give you such error

Try erasing one of them.
I hope this help you.

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.