• Post Reply 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Rpelacing characters (*) with user input

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> Does anyone know a good way to do this?

good - no, dodgy - yes.

 
Brady Diggs
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Brady Diggs wrote:Paul -


Paul?
 
Brady Diggs
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rob Camick's Text Prompt may be useful.
 
Brady Diggs
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic