Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2007
    Posts
    45
    Rep Power
    0

    Post Last focused component

    If FocusTravelPolicy transfer focus in order jc1,jc2,jc3,jc4,jc5 (These are swing components in a JFrame). My current focus is within jc2 and then I click on jc4 i.e. focus will be transfered to jc4 that can be obtained by
    Java Code:
    KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()
    and we can get jc3 using
    Java Code:
     KeyboardFocusManager.getCurrentKeyboardFocusManager().getDefaultFocusTraversalPolicy()
    .getLastComponentKeyboardFocusManager.getCurrentKeyboardFocusManager().getCurrentFocusCycleRoot())
    Now, I want to get jc2 because we receive focus on jc4 just after jc2.

    My problem is that how to get last focused compoent?
    Last edited by Gajesh Tripathi; 11-21-2009 at 01:29 PM.

  2. #2
    Join Date
    Aug 2007
    Posts
    45
    Rep Power
    0

    Post Waiting for Reply

    Dear All,

    Kindly solve my problem. I am very puzzled about it.
    My Problem is Simple: How to get last focus owner component? e.g. we are at bttnSave (or else) and then click on a text field txtName. I want to get component that was owned focus before getting focus in text field.

    So I hope, now you understand my problem.

    Thanks In Advance
    Gajesh T.

  3. #3
    zweibieren is offline Senior Member
    Join Date
    Aug 2009
    Location
    Pittsburgh, PA
    Posts
    284
    Rep Power
    6

Similar Threads

  1. add component to component
    By Omarero in forum New To Java
    Replies: 7
    Last Post: 05-17-2009, 03:39 PM
  2. how to make window active and textfield focused
    By whwillisiv in forum New To Java
    Replies: 0
    Last Post: 04-28-2009, 05:06 AM
  3. Find Component by name
    By amjad905 in forum Advanced Java
    Replies: 9
    Last Post: 04-25-2009, 06:55 PM
  4. Same component on all JTabbedPane
    By java_novice in forum AWT / Swing
    Replies: 4
    Last Post: 08-06-2007, 10:09 AM
  5. Help with custom component
    By Falcon1 in forum AWT / Swing
    Replies: 8
    Last Post: 07-21-2007, 01:39 PM

Posting Permissions

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