This discussion is archived
2 Replies Latest reply: Feb 6, 2013 8:02 AM by abillconsl RSS

how to get return values from a button to main program.

989157 Newbie
Currently Being Moderated

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

//need code here for enabling table
enable table editing


// 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"))
return null;


  • Correct Answers - 10 points
  • Helpful Answers - 5 points