java - Display/disappear default text in TextField when user enters data/erase the text -


i trying make registration form , trying display default text in text fields, simple meaning below image. trying , until user enters data field example there field called "first name". when user selects field "first name" text disappears , user can type first name. if user doesn't type anything, text should display again in text field.

i tried using focus listener, couldn't work because method if user types data field , go next field , text of previous field gets deleted , default text gets displayed.

here have done :-

txtfirstname.addfocuslistener(new focuslistener() {     public void focusgained(focusevent e) {         txtfirstname.settext("");     }      public void focuslost(focusevent e) {         txtfirstname.settext("first name");     } }); 

what trying do

thank time.

what trying , until user enters data field example there field called "first name". when user selects field "first name" text disappears , user can type first name. if user doesn't type anything, text should display again in text field.

i think looking prompt, see


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -