Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Show default text in PasswordTextBox.

 
Nilesh Pat
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to show some default text in PasswordTextBox. first time.
when user clicks on that text box the text should get removed n then i want to allow user to enter password.
so at 1st time it should show text, n then password characters...

 
salvin francis
Bartender
Posts: 1280
10
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why have you posted in bold, huge letters ?

You could do something simple like using a label to display a message and when it's clicked, show a password box there.
 
Maneesh Godbole
Saloon Keeper
Posts: 11070
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Salvin is correct.
Nilesh you can use the button to remove the bold
 
Nilesh Pat
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:Salvin is correct.
Nilesh you can use the button to remove the bold




thank you for your replay..
and it was my first time when i post this message so.
 
salvin francis
Bartender
Posts: 1280
10
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try my suggested solution Nilesh ?
 
Nilesh Pat
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i tried it's demo just now.
it's good solution. but i am using rounded corner text boxes. so i have to adjust label perfectly on password text box.
hope it will work.
 
salvin francis
Bartender
Posts: 1280
10
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nilesh Pat wrote:yes i tried it's demo just now.
it's good solution. but i am using rounded corner text boxes. so i have to adjust label perfectly on password text box.
hope it will work.


I believe there is no such thing as a rounded corner textbox,
I think you are probably wrapping up your password widget in a panel having rounded corners (mostly a decorated panel)

What I am suggesting is to wrap a label instead of a password widget in the same place and when user clicks it, change it back to password widget.
 
Nilesh Pat
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i have used a single image of a rounded rectangle and set it as background of password textbox in css.
and then set the text box in a cell of flex table.

can i put two widgets in same cell?? so i can set one visible. and another invisible.
i think it will..
 
salvin francis
Bartender
Posts: 1280
10
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nilesh Pat wrote:
can i put two widgets in same cell?


In the realm of HTML thats possible, in GWT, there is just one setWidget(Widget w) method, so you cant.

However, you could make a widget that contains 2 widgets and shows one at a time.
It sounds like a candidate for the DeckPanel. Heck i would prefer the horizontal panel with one element visible at a time.

As for the rounded corner background, its probably just a style, I dont see why that could create issues.
 
Jay Kang
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my first time to post:

The way I solved this problem was to extend the TextBox and create a new widget (It was because I had a promptTextBox, which I used for both password and textbox functions: the original source was from turbomanage).

*note: because I'm using this as both a TextBox and PasswordTextBox, I added a Boolean isPassword to my constructor

1st I implement keypresshandler on the widget that extends the TextBox.

2nd onkeypress, I just store what they type into a String called passwordString, and cancel the input, then insert another String called masked with the ASCII code for *.


I know of the old swap of label with textbox, but I don't like the solution because when you add styles, it kind shifts a little.
I don't know how good the solution is for security, so use it at your own risk.

Hope this helps.

Jay
 
David Tolioupov
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in case anyone wondered here is a very simple solution:

TextBox textBox = new TextBox();
textBox.getElement().setPropertyString("type", "password");
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic