Results 1 to 5 of 5

Thread: Setting focus

  1. #1
    carderne is offline Senior Member
    Join Date
    Nov 2007
    Posts
    160
    Rep Power
    8

    Default Setting focus

    Is there a way that I can choose which component in my JFrame has focus when the program starts up?

    At the moment it defaults to quite a random component...

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Have you looked at the requestFocus() or requestFocusInWindow methods?

  3. #3
    carderne is offline Senior Member
    Join Date
    Nov 2007
    Posts
    160
    Rep Power
    8

    Default

    I hadn't, but I certainly will do.

  4. #4
    carderne is offline Senior Member
    Join Date
    Nov 2007
    Posts
    160
    Rep Power
    8

    Default

    Success. Thank you very much. SOLVED.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. set focus to the textfield
    By paty in forum New To Java
    Replies: 2
    Last Post: 07-09-2010, 09:28 AM
  2. setting focus to an applet on a different page
    By hunterbdb in forum Java Applets
    Replies: 4
    Last Post: 11-09-2008, 07:21 AM
  3. DialogPage needs to go in and out of focus
    By dragonwitch in forum SWT / JFace
    Replies: 6
    Last Post: 09-17-2008, 01:26 AM
  4. how to focus to another JTextfield?
    By birdofprey in forum AWT / Swing
    Replies: 2
    Last Post: 04-09-2008, 02:08 PM
  5. Focus
    By Marty in forum AWT / Swing
    Replies: 1
    Last Post: 05-31-2007, 03:16 AM

Posting Permissions

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