public class Member extends JFrame implements ActionListener
{
......
public boolean check(String id, String pass)
{
if(id == memberID && pass == password)
return true;
else
return false;
}
......
}
Then I need to call that check() method from my MainMenu class using button b1...
public class MainMenu extends JFrame implements ActionListener
{
......
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == b2)
{
memlist[i] = new Member();
memlist[i].setSize(400,200);
memlist[i].setVisible(true);
i++;
}
if(e.getSource() == b1)
{
int temp = 0;
for(int j = 0; j < i; j++)
{
if(memlist[i].check(t1.getText(), t2.getText()) == true);
{
JOptionPane.showMessageDialog(null, "You are logged in");
temp++;
}
}
if(temp == 0)
{
JOptionPane.showMessageDialog(null, "Wrong ID an password!!!");
}
}
}
....
}
I would get an exception every time I clicked b1. How can I call the method() without getting exception?
This post has been edited by soldierno77: 30 August 2010 - 05:52 AM

New Topic/Question
Reply




MultiQuote








|