facebook

Setting a field in focus

  1. MyEclipse Archived
  2.  > 
  3. Matisse/Swing UI Development
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #268174 Reply

    Chris
    Member

    Hi,
    I have a form with sone password fiels on. I’m trying to get the first field in focus when the JPannel is displayed.

    I’ve tried all the options in matisse and I can’t get any of the text fields in focus. I’ve tried to hard code the values using

    jPasswordField1.setFocusable(true);
    jPasswordField1.setFocusCycleRoot(true);
    jPasswordField1.setRequestFocusEnabled(true);
    jPasswordField1.requestFocus();

    I can’t even tab to the first field. I have to click on it. I have other forms that work just fine.

    Thanks,

    Chris

    #268193 Reply

    Riyad Kalla
    Member

    Chris,
    By default all text fields should be included in the tab-cycle, so you might want to remove all that custom code, it might be undoing something. lastly you will want to make sure the requestFocus is getting called after the form becomes visible.

    #269163 Reply

    Chris
    Member

    Hi,
    I had to add the request focus from the top level JFrame for the password field. This worked fine.

    Thanks,

    Chris

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Setting a field in focus

You must be logged in to post in the forum log in