Posted by igorlukanin
on January 22, 2010 at 12:33 PM PST
A short time ago I tried to use JXLayer to wrap my JTextField's and show validation result icons over them. These JXLayer's were passed to layout manager instead of wrapped components.
Then I faced a problem with layout: I use DesignGridLayout that respects components' baselines to properly align them vertically. With JXLayer wrappers it got broken.
I investigated that JXLayer doesn't delegate to getBaseline(w,h) of wrapped component, so that's the root of the problem. An obvious solution of subclassing JXLayer and overriding that very one method to implement delegation appeared to be impossible, because JXLayer is declared final.
So I decided to remove jxlayer lib from Maven-managed dependencies list, downloaded its source code, manually added to project's source tree, and patched it by removing "final" from JXLayer declaration.
In fact, this dirty hack doesn't seem to be the right way. So, I have two questions:
1. Aren't I missing something and there's some API or something to solve my problem without such hacks?
2. If not, isn't this a subject to fix JXLayer (make it non-final)? What was the motivation for making it final, if anybody knows?