• Post Reply Bookmark Topic Watch Topic
  • New Topic

if's and while's spinning in my head.  RSS feed

 
Tessa Harm
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! I'm trying to get an event to trigger if it matches the passkey and userkey. I know there's probably a better way to do a login, but I thought this would be a good exercise in if's and whiles. They're however spinning circles in my head. The obvious happens, I try the password once and then that JOptionPane keeps showing over and over, lol. How can I go back to trying the password again if test is not 2? Should I be using a different kind of loop?

Thank you for your time.


 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not build something like:
 
Tessa Harm
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I didn't realise you could use that && thingie in there.

Now, I however have...



... But it stops at "Getting source from Button". I'm assuming it's something to do with passkey being an object but actually a string... or something like that?
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tessa Harm wrote:
Now, I however have...

... But it stops at "Getting source from Button". I'm assuming it's something to do with passkey being an object but actually a string... or something like that?


Oh, it's not stopping there, and more than likely it's moving on and possibly getting stuck at this line:

Could it possibly be that creating a new ServerData starts up a long-running process that ties down Swing's main thread the EDT. Are you sure that you shouldn't be creating this class in a different thread?
 
Tessa Harm
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I put a system.out.println in just before



It doesn't print "Found button1", so it doesn't go into the the if statement at all?
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed and since that there are 3 conditions you'll need to check those 3.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!