Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.flexstor.common.awt
Class FlexFocusManager  view FlexFocusManager download FlexFocusManager.java

java.lang.Object
  extended byjava.awt.event.FocusAdapter
      extended bycom.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.


Field Summary
(package private)  int countdown
           
(package private)  java.awt.Component currentfocus
           
(package private)  boolean focusGained
           
(package private)  int recursion
           
(package private)  java.awt.Window surface
           
(package private)  java.awt.Component targetfocus
           
 
Constructor Summary
FlexFocusManager(java.awt.Component targetfocus)
           
FlexFocusManager(java.awt.Window surface, java.awt.Component targetfocus)
           
 
Method Summary
private static java.awt.Window findWindow(java.awt.Component c)
           
 void focusGained(java.awt.event.FocusEvent e)
          Implements this method from the interface with an empty body.
static java.awt.Component getDefaultFocusComponent(java.awt.Container start)
           
private static boolean isEqualOrChild(java.awt.Component currentFocus, java.awt.Component targetFocus)
           
private  void reqFocus()
           
 void run()
          This method will be called by whoever wishes to run your class implementing Runnable.
 void setFocus()
           
 
Methods inherited from class java.awt.event.FocusAdapter
focusLost
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

focusGained

boolean focusGained

surface

java.awt.Window surface

targetfocus

java.awt.Component targetfocus

currentfocus

java.awt.Component currentfocus

recursion

int recursion

countdown

int countdown
Constructor Detail

FlexFocusManager

public FlexFocusManager(java.awt.Component targetfocus)

FlexFocusManager

public FlexFocusManager(java.awt.Window surface,
                        java.awt.Component targetfocus)
Method Detail

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)