How to focus one component in a window

I need popup one window in my page. In that window, there is one text field.

My question is that how to focus that text field after the window popup?

I have tried to call the ''focus" method of that textfield after I show that window, But it doesn’t work at all.

Any help will be greatly appreciated.

I resolve this issue by myself.

I add the focus listener for that window, in which I focus the component I want.