Results 1 to 2 of 2

Thread: set tabindex/focus

  1. #1
    vastest
    Guest

    Question set tabindex/focus

    I created a form in swing/jdk1.4 and I want to set tabindex or setFocus on pressing tab key to move cursor next field.

    Please help and give any suggestions.

  2. #2
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Let's say that you have a JLabel and a JTextField. You can create a mnemonic for the label that when pressed will jump to the text field. setDisplayedMnemonic(char c) can be used on the JLabel and setLabelFor(Component c) can be used on the JTextField.

    The other way would be to either set the nextFocusableComponent property or call the requestFocus() on the component itself.

    If all you have is JTextFields and JLabels then the focus manager should just tab to the next JTextField when the tab key is pressed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width