java.lang.Object
java.awt.event.FocusAdapter
com.flexstor.common.awt.FlexFocusManager
- All Implemented Interfaces:
- java.util.EventListener, java.awt.event.FocusListener, java.lang.Runnable
- public class FlexFocusManager
- extends java.awt.event.FocusAdapter
- implements java.lang.Runnable
(almost) Foolproof component focus setter, will repeatedly call requestFocus for a
component in a different thread each time.
Uses getCurrentFocus() and focusGained methods to check for success.
Brute forces its way through a myriad of
jdk bugs that put the focus all over the place, kill the requestFocus method, etc.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
focusGained
boolean focusGained
surface
java.awt.Window surface
targetfocus
java.awt.Component targetfocus
currentfocus
java.awt.Component currentfocus
recursion
int recursion
countdown
int countdown
FlexFocusManager
public FlexFocusManager(java.awt.Component targetfocus)
FlexFocusManager
public FlexFocusManager(java.awt.Window surface,
java.awt.Component targetfocus)
findWindow
private static java.awt.Window findWindow(java.awt.Component c)
setFocus
public void setFocus()
focusGained
public void focusGained(java.awt.event.FocusEvent e)
- Description copied from class:
java.awt.event.FocusAdapter
- Implements this method from the interface with an empty body.
- Specified by:
focusGained in interface java.awt.event.FocusListener
reqFocus
private void reqFocus()
run
public void run()
- Description copied from interface:
java.lang.Runnable
- This method will be called by whoever wishes to run your class
implementing Runnable. Note that there are no restrictions on what
you are allowed to do in the run method, except that you cannot
throw a checked exception.
- Specified by:
run in interface java.lang.Runnable
isEqualOrChild
private static boolean isEqualOrChild(java.awt.Component currentFocus,
java.awt.Component targetFocus)
getDefaultFocusComponent
public static java.awt.Component getDefaultFocusComponent(java.awt.Container start)