<Swing Dev> <AWT Dev> Webrev available for rfe 6929295 Generic support of mouse event transformation for AWT/Swing
Alexander Potochkin
Alexander.Potochkin at Sun.COM
Thu Apr 15 10:20:10 UTC 2010
Hello Anthony
> Hi Piet,
>
> I've reviewed the AWT part of the fix only. Some comments follow.
>
> src/share/classes/java/awt/Container.java
>> 2356 * @throws IllegalComponentStateException when inverse
>> transformation is not possible
>
> I believe IllegalArgumentException works best in that case since whether
> or not it is thrown depends on the x, y arguments (and the state - the
> transform - of course, but that's not the primary reason for the method
> to fail).
ICSE was chosen for several goods reasons,
first of all throwing an exception
does not really depend on x and y params
If an inverse transformation can't be done,
it is true for every x and y
It happens when a component's bounds degrade
to a line or to a point, e.g. scaling it down to 0,0
In this sense it is all about the component state
So I think ICSE is in a good place here
Leaving the rest of comments for Piet...
Thanks!
alexp
>
>
> src/share/classes/java/awt/Component.java
>> 2045 if (peer instanceof LightweightPeer) {
>> 2089 if (peer instanceof LightweightPeer) {
>
> I suggest using the isLightweight() method instead.
>
>
>> 2081 * or if an invocation of {@link Container#toLayoutSpace(int,
>> int)} throws
>> 2082 * this Exception.
>
> My comment above regarding the ICSE applies to this note as well.
>
>
>> 2089 if (peer instanceof LightweightPeer) {
>> 2090 Container host = getNativeContainer();
>> 2091 if (this == host) {
>
> How could that happen? The peer is lightweight and the component is a
> *native* host?
>
> --
> best regards,
> Anthony
>
> On 4/14/2010 8:13 PM Piet Blok wrote:
>> Hi all,
>>
>> A webrev is available for rfe 6929295 Generic support of mouse event
>> transformation for AWT/Swing.
>> http://www.pbjar.org/OpenJDK/6929295/webrev/
>>
>> To better understand the concept, I created a document "How to use
>> transformations in Swing"
>> http://www.pbjar.org/JLayer/doc/HowToUseTransform.html
>>
>> Please review,
>>
>> Thanks
>> Piet
>>
More information about the swing-dev
mailing list