flavio.donze flavio.donze - 1 year ago 109
Java Question

Where to set the focus in wizard pages?

I have a

containing two wizard pages (
) and would like to set the focus for each page separately so that always the top input field of each page is focused.

Setting the focus in
, the first page focus is set correctly. The second page does not have a focus.
This is due to
which creates all the pages at the beginning.

Where would be the place to handle the focus after switched to the next wizard page?

Answer Source

Override the WizardPage setVisible method and set focus when the page becomes visible:

public void setVisible(boolean visible) {

    if (visible) {
       // TODO set focus
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download