hello,
I have a main program which has a button Authenticate. On click of authenticate open a form for auth which has USERNAME FIELS AND PASSWORD.
If entered fields are true then enable editing of jtable in main program..
Basically something like this :
//main program
Authenticate.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
UpdateAuth ua=new UpdateAuth();// opens form which has username and pass for authentication
ua.setVisible(true);
//need code here for enabling table
if(s=="mactus")
{
enable table editing
}
//table.repaint();
}
});
// form open for auth..(class UpdateAuth )
private String SigninMouseClicked(java.awt.event.MouseEvent evt) {
String aname=Aname.getText();
String apass=Apassword.getText();
if(aname.equals("") && apass.equals(""))
{
JOptionPane.showMessageDialog(null,"Enter login name or password","Error",JOptionPane.ERROR_MESSAGE);
}
if(!(aname.equals("") && apass.equals("")))
{
if(aname.equals("harshil") && apass.equals("harshil123"))
{
String s="mactus"; /// if username and password is success enable table editing in main program
return s;
}
else if (!aname.equals("mactus") && !apass.equals("mactus123"))
{
Aname.setText("");
Apassword.setText("");
}
}
return null;
}