This week's book giveaway is in the NodeJS forum.
We're giving away four copies of Serverless Applications with Node.js and have Slobodan Stojanovic & Aleksandar Simovic on-line!
See this thread for details.
Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Problem with Text Fields  RSS feed

 
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,
I have designed a simple application using card layout. The layout of first card in it is set as group layout. This first card contains two JLabels, One text field, password field and a button named ok.
i have used two strings, one to store the name and other to store the password. Now what i need is when i enter the same name and password then i should get the next card. But when i click the ok button without entering any text in the fields, then also i am able to get the next card. For the button i have written the code. I guess the problem is with my code and the code is as follows:



final String str = "adeeb";
final String str1 = "alexander";

ok.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{

if(currcard==1)
{

if(pf.getText().equals(str1));
{

if(tf.getText().equals(str));

{

cl.show(panel, "2");
}
}
}
}
});
So i am unable to solve this problem. Please Some One solve it.
 
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
You've already asked this question here. Please continue discussion in that thread.
 
Mo-om! You're embarassing me! Can you just read a tiny ad like a normal person?
global solutions you can do at home or in your backyard
https://www.kickstarter.com/projects/paulwheaton/better-world-boo
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!