<Swing Dev> JScrollPane optimized drawing issue
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Wed Sep 23 17:23:01 UTC 2015
On 21.09.15 18:12, Alan Snyder wrote:
> I have implemented a scroll pane UI that simulates the modern OS X scroll bars that are painted over the viewport rather than occupying their own space in the scroll pane. Overlaying the scroll bars requires that the scroll pane return false from isOptimizedDrawingEnabled(). However, JScrollPane.isOptimizedDrawingEnabled() is hardwired to return true. Although subclassing JScrollPane is a workaround, it is not a good solution, because it breaks the orthogonality of component and component UI. It would mean, for example, that a UI created using the NetBeans UI designer could not use overlay scroll bars.
>
> Another workaround I have thought of but am reluctant to pursue is to install a custom viewport that paints the scroll bars.
>
> Given the general ability of a component UI to install a layout manager, it strikes me as odd that isOptimizedDrawingEnabled() is not implemented as an attribute, as it is in JLayeredPane. Is there a reason for this?
Another possible solution is to add a setter for this property, after
that the UI delegate can change it during install/deinstall.
>
> Any suggestions?
>
> Alan
>
--
Best regards, Sergey.
More information about the swing-dev
mailing list