简体   繁体   中英

does anyone know how to give a hint text in textFields in java(netbeans)?

anyone know how to give a hint text in textField in java netbeans

eg: Text Field where user have to enter his Name i wanna give hidden text "name"

您可以使用setToolTipText

text1.setToolTipText("Hint");

first set the text of the textfield to "Name".

private void jTextField2MouseClicked(java.awt.event.MouseEvent evt) {                                         
   jTextField2.setText(null);
}  

After writing the above code and clicking on the textfield the "Name" will disapper and u can enter your text.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM