• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Rpelacing characters (*) with user input

 
Brady Diggs
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all -
There has to be a simple solution to this, but as far as I've searched, I've found nothing.
I have a Custom TextField that is descended from java.awt.TextField (believe me, I'd much rather use swing).
The user must enter 14 characters into this field.
The problem is, most of those characters are zeros and they have to count for every keyboard
stroke they hit.
I want to put in fourteen * so every time they enter a character, the * is replaced by
their input. That way, they see how many characters they have left because the * will be one less
for every letter or number they put in.
Like this:
**************
B*************
BN************
BNO************
BNO4**********

And so on.

Does anyone know a good way to do this?
I am an experienced developer, but have never had this challenge before.

Any help would be greatly appreciated.

Brady
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Does anyone know a good way to do this?

good - no, dodgy - yes.

 
Brady Diggs
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul -
Thanks for responding.
You were right... it was a bit dodgy
Thanks for the try, though, but I need to change the characters
one at a time as they are typed.
I know there's a way to do this, but I may be limited as I am working
in 1.4
Anyway, thanks for the reply.

Brady
 
Darryl Burke
Bartender
Posts: 5136
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brady Diggs wrote:Paul -

Paul?
 
Brady Diggs
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So sorry, Michael. Don't know where I got Paul...
Thanks for the correction Darryl.

But thanks for the reply Michael.
But I still haven't found and elegant solution to this.
If anyone has any suggestions, I would be your slave
your life.
Thanks!
 
Darryl Burke
Bartender
Posts: 5136
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Camick's Text Prompt may be useful.
 
Brady Diggs
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Darryl!
That's not exactly what I need, but I can certainly use
some of his design.
I appreciate you pointing me to it.
Rob does it again!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic