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();
    }
}

Edited 5 Years Ago by masijade: added code tags

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.

This article has been dead for over six months. Start a new discussion instead.