This site requires JavaScript, please enable it in your browser!
Greenfoot back
ateichner
ateichner wrote ...

2011/6/30

Making Password Fields

ateichner ateichner

2011/6/30

#
Hi I'm new to Greenfoot and am using it because I'm doing a summer assignment for my AP CS class. My assignment is to create a simple security scenario that utilizes a username and password... But there's a catch: once a username/password combination has been used, it can't be reused (like a plastic electronic voting key, which selects a new username and password every time a person uses that key from a pre-made database). I've already got a blue background as my world, but now I need to figure out how to make the input fields themselves. How would I do this? Thanks
DonaldDuck DonaldDuck

2011/6/30

#
I suggest looking at JInputPanels and JOptionPanels in javax.swing. They're pretty low-fi, but they save the trouble of making a class yourself to read text input. I would suggest having an array of already used user/pass combinations and check the input against the array. Good luck!
davmac davmac

2011/7/1

#
On the other hand, popup input panels (that Swing provides) are very annoying for the user. There are a already several Greenfoot GUI libraries: GUI Components TextBox01 Greenfoot GUI UILibrary GUI World Even if none of them have an input field, you could probably implement one by using a regular text field as a basis.
ateichner ateichner

2011/7/1

#
Ok thanks I'll try that.
DonaldDuck DonaldDuck

2011/7/1

#
It's true. Swing input panels are quite annoying, but they are very easy to program with and it will be more original work for your assignment instead of snagging someone's else's code snippet.
mjrb4 mjrb4

2011/7/4

#
There's nothing wrong with reusing someone else's code (providing you attribute it) in fact I'd say that's a good thing, it shows initiative rather than reinventing the wheel! Learning to code in swing is very useful generally, but there's all sorts of subtle things that you need to know about to do it properly without introducing the potential for subtle bugs. That combined with the fact that it generally looks far better from an aesthetic perspective, I'd always advise going for integrated components in Greenfoot rather than annoying Swing popups. Not that I can talk, I'm sure I've used them at least once or twice when I was in a rush...!
ateichner ateichner

2011/7/6

#
Thanks for the advice... I decided to use bourne's GUI and then modify it to act as two components that work as a team to identify a username/ password combo. Thanks!
You need to login to post a reply.