<AWT Dev> <Swing Dev> Public RequestFocusController/AWTAccessor API
semyon.sadetsky at oracle.com
Thu Apr 14 06:30:49 UTC 2016
It is unlikely that AWTAccessor API may be opened. It gives access to
internal undocumented methods not to even mention that those methods
have private and package accesses.
As I understand you need the way to intercept focus transfer initiated
by a traversal key. Why to subclass the DefaultKeyboardFocusManager to
override its focusNextComponent/ focusPreviousComponent methods?
On 4/12/2016 2:37 PM, Reto Merz wrote:
> Hello Alexandr,
> Basically we need to detect and intercept focus changes.
> java.awt.Component allows to override this methods:
> requestFocus() is only invoked when the component is focused by a mouse click.
> But no requestFocus* method is invoked when a FocusTraversalPolicy is involed
> (f. e. the user press TAB to focus next component).
> sun.awt.RequestFocusController#acceptRequestFocus is invoked in both cases.
> Attached a demo to reproduce it:
> - if TextField is focused by a mouse click "requestFocus" and "acceptRequestFocus" is logged
> - if TextField is focused by TAB only "acceptRequestFocus" is logged
> Some more notes about the test program:
> ComponentAccessorDelegator delegates all calls to the original ComponentAccessor implementation.
> Only ComponentAccessor#setRequestFocusController is changed to keep our RequestFocusController implementation.
> I have just filled a RFE on http://bugreport.java.com/bugreport
> Reto Merz
> On 11/04/16 21:02, Alexander Scherbatiy wrote:
>> Hello Reto,
>> Could you provide use cases which illustrate tasks the requested API is intended to solve in your application?
>> Please, also create a request in the bug system http://bugreport.java.com/bugreport
>>> On 11/04/16 12:26, Alexander Scherbatiy wrote:
>>> Resending the request to awt-dev alias.
>>> On 4/4/2016 4:54 PM, Reto Merz wrote:
>>>> Jigsaw will disallow access to internal packages.
>>>> We have written a complex validation and focus management
>>>> implementation for our closed-source RIA and maintain it since JRE
>>>> For this we use some internal API. We have a custom implementation of
>>>> these interfaces:
>>>> And use this getter and setter:
>>>> Please make this API public.
>>>> Furthermore we need to call
>>>> We do this with reflection. It would be nice to have a public API for
>>>> Maybe a new static method on AWTAccessor:
>>>> Best Regards
>>>> Reto Merz
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the awt-dev