Text field


i want to hide the blinking cursor for a text field which is in read only

pls help me out.

I don’t think its possible to hide the blinking cursor. However, since its read only you can remove the focus from text field .


hi Azhar,

i tried to remove focus , but if m explicitly clicking then its not working ,
i am using IE
plz help me


Well, since there is no direct way to achieve this, perhaps you can try this.

  1. add focus listener to your text field
  2. onFocus set the focus to other component on page.

Hope this helps.


i think i can’t add focus listner to read only text field.
i tried its not working…

Why shouldn’t it work. A Textfield set to ReadOnly Mode is in no way different to a “normal” Textfield when it comes to Listeners.

txt.addFocusListener(new FocusListener() {
    public void focus(FocusEvent event) {

yeah it workd, but caret is still showing?