• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Query about loginDialog Interface??

 
Bikash Paul
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all friends,
I am facing problem with my loginDialog(swing interface).I want to close that loginDialog interface and open another interface in case of matching of userid and password and in case of mismatch i want to refresh that window and focusing on userid text field for that iam taking the password from the servlet which is returning by servlet after matching of userid and password supplied by the user with userid and password stored in database.And i tried to put 'Equal to' operator between two passwords one is taken from swing interafce by(txtpassword=password.getText(); )which is supplied by the user and other is taken from servlet(which is returning by servlet after mactching with database) and i also print both password and it is giving me same value.But my if and else statement not executing.I didn't understand why it is not executing.Can any one plz tell me Is it the right way what iam doing or is there any good way plz guide me.
below r my codes(iam pasting only those portion of my codes):-
BufferedReader inputFromServlet = new BufferedReader(new InputStreamReader(uc.getInputStream()));
String msgFromServlet=null;
while((msgFromServlet=inputFromServlet.readLine())!=null)
System.out.println(msgFromServlet);
System.out.println(txtpassword);
String msgFromServlet1=msgFromServlet.trim();
if(txtpassword==msgFromServlet1)
{
login_dialog frame1 = new login_dialog();
frame1.setVisible(false);
System.out.println("Inside loop");
My1stFrame frame = new My1stFrame();
frame.pack();
frame.setResizable(false);
frame.setSize(new Dimension(357,400));
frame.setLocation(100,100);
frame.setVisible(true);
}
else
{
userid.setText("");
password.setText("");
userid.requestFocus();
}
Regards
Bikash
 
Bikash Paul
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have sloved my problem of if and else statement by changing the code of

if(txtpassword==msgFromServlet1)
by
if(txtpassword.equals(msgFromServlet1))
now my if and else statement is working fine and it also opens my working interface but loginDialog interface is still open but for closing loginDialog I coded in If statement:-
login_dialog frame1 = new login_dialog();
frame1.setVisible(false);
But this code is not working.Can any one plz guide me where i am wrong.
Regards
Bikash
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you opening 2 dialogs. Why are you creating a new one then setting it invisible? What happens to the one that already exists?
 
Bikash Paul
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Stevens,
I have also sloved my this problem by modifying my previous code.
if(txtpassword.equals(msgFromServlet1))
{
setVisible(false);
dispose();
System.out.println("Inside loop");
My1stFrame frame = new My1stFrame();
frame.pack();
frame.setResizable(false);
frame.setSize(new Dimension(357,400));
frame.setLocation(100,100);
frame.setVisible(true);
}
else
{
userid.setText("");
password.setText("");
userid.requestFocus();
}
Regards
Bikash
[ January 30, 2003: Message edited by: Bikash Paul ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic