While working on a blackberry project I was required to display a round corner text field with a place holder text. The logic was to display place holder text when TextField is not in focus and no text is entered by user (or text is cleared by user). As soon as TextField receives focus, placeholder text should be removed. Displaying place holder text when TextField is empty is very easy . You can just override TextField's paint method and check if text is empty you can set text to place holder text. Here is a simple example protected void paint(Graphics g){ if (getText().compareTo("")==0){ setText( "Place holder text.." ); } super.paint(g); } But displaying and removing of placeholder text on focus and unfocus was a bit of task so I came up with my own class and want to share with other fellow coders. import net.rim.device.api.ui.Color; import net.rim.device.api.ui.Graphics; import net.rim.device...
I document random stuff on this Blog. It can be a piece of code , my personal experience, a fun fact or anything else.