JDK-4220839 : Tweak JComponent to support swapping FocusManagers
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 1999-03-16
  • Updated: 2001-01-12
  • Resolved: 2001-01-12
Related Reports
Duplicate :  
Duplicate :  
Description

Name: dbT83986			Date: 03/16/99


1) Swing has no provision for swapping focus managers while 
traversing containers and
2) Keyboard focus traversal can loop if first component is
pointed at by some other component (in other words, you don't 
want the default first component in a container to really
be the first component)

These two bugs prevent useful collections of components from
easily being made into container beans.
(Review ID: 53517)
======================================================================

Comments
WORK AROUND Name: dbT83986 Date: 03/16/99 Tweaks to support swapping FocusManagers, and fix looping bug: 1) Add setNextFocusableComponent( Component startingComponent, Component nextComponent) and getNextFocusableComponent(Component startingComponent) to FocusManager. 2) Have JComponent.setNextFocusableComponent() and getNextFocusableComponent()to call FocusManager.getCurrentManager().setNextFocusableComponent() and FocusManager.getCurrentManager().getNextFocusableComponent() What this achieves is that the focus manager can now identify and take action on the order component focus is to be traversed. FocusManagers could then detect if the default first component in a container is being recursively pointed to and fix it. To complete the fix: 3) Add to FocusManager setFirstComponent(Container aContainer, Component component) and setLastComponent(Container aContainer, Component component) 4) Have FocusManager getFirstComponent(Container aContainer) and getLastComponent(Container aContainer) check and see if component(s) have been explicitly set to be either the first or the last. 5) Add to FocusManager setFocusManager(Contianer aContainer, FocusManager fm) and getFocusManager(Contianer aContainer) 6) Have getFirstComponent() and getLastComponent() check to see if a FocusManager has been set in any of its parent containers that is different from the current FocusManager. If so then setCurrentManager(getFocusManager(Contianer aContainer)) (yeah, I know that logic needs work) This all preserves developer's existing code (I think) and only adds clientProperties when these features are used, so JComponent isn't being made even bigger. The only real overhead are the several additional calls to focus manager. Thanks for letting me bend your ear ======================================================================
11-06-2004

EVALUATION I believe these problems have been addressed with the focus enhancements we have put in for merlin. Closing as dup of 4290675: Focus Management Enhancements hania.gajewska@Eng 2001-01-11
11-01-2001