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?

Any suggestions?

  Alan

Reply via email to