<AWT Dev> Global InputVerifier

Reto Merz reto.merz at abacus.ch
Thu Mar 16 00:17:36 UTC 2017


Hello,

We try to prepare our WebStart-based app for Java 9.
It is very important that we can perform validation on every focus change and reject it if needed
based on which target component will be focused.
At the moment we use sun.awt.RequestFocusController which is invoked on every focus change
and provides the source and the *target* component  (which would be finally focused)
if acceptRequestFocus returns true.

I have already request an API for this:
http://mail.openjdk.java.net/pipermail/awt-dev/2016-April/011076.html
https://bugs.openjdk.java.net/browse/JDK-8154431

The extended InputVerifier with the new method verifyTarget works as expected.
But the problem is that we need to set the InputVerifier on *every* JComponent that is created
because it is possible that this components owns the focus just before one of *our* component gets focused.
This is not practicable because our app also contains complex third-party components like a HTML editor.
Such third-party components are composed of several focusable components like a font-combobox in case of the HTML editor
and of course they can dynamically create/remove additional components.

So in our case what we need is to register a global InputVerifier which is invoked
on every focus change.

Thanks
Reto

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20170316/1e468b5a/attachment-0001.html>


More information about the awt-dev mailing list