Fix your JScrollPane's resizable corner under Aqua

Regular mac windows have a grippy control in the bottom right hand corner that allows you to resize the window. Unfortunately, most Swing apps don't take this control into consideration, and it's painted right over their precious scrollbar buttons! Here's two versions of the same application, before and after fixing the problem:

resize corner

Fortunately, there's a fix. Either use the most excellent quaqua look and feel, or use my simple ScrollPaneLayout hack:

* A scrollpane layout that handles the resize box in the bottom right corner.
* @author <a href="">Jesse Wilson</a>
public class MacCornerScrollPaneLayoutManager extends ScrollPaneLayout {
private static final int CORNER_HEIGHT = 14;
public static void install(JScrollPane scrollPane) {
if(System.getProperty("").startsWith("Mac")) {
scrollPane.setLayout(new MacCornerScrollPaneLayoutManager());
public void layoutContainer(Container container) {
if(!hsb.isVisible() && vsb != null) {
Rectangle bounds = new Rectangle(vsb.getBounds());
bounds.height = Math.max(0, bounds.height - CORNER_HEIGHT);
To make this work even better, consider requesting the JScrollPane's bounds, and compare them with the JFrame's bounds. If the scrollpane and the frame share a common right hand corner, that's the only time we'll really need to perform an adjustment.
I've one problem with JSP (JScrollPane).

I've one JTable in the center of JSP whose header should appear as column header of JSP, and then I've another table which is placed in the row header of JSP, whose header I placed explicitly in UPPER_LEFT_CORNER of the JSP.

Now, my center JTable is dynamic, and sometimes I dont want to display any of its column either. I handle it through the Table Model.

The problem is, when the main table doesnt have anything to show, ie, when it does not have any column, its column header doesnt get painted (fine). but due to this, the row header table's column header also get disappeared (Acc to SUN: the corner component is visible only if the intersecting row/colum components are visible ).

I am looking for some way to either Subclass JScrollPane or some of its components to override this behavior so that the corner component is ALWAYS visible.

I tried to extend and use "ScrollPaneLayout" with colHead / upperLeft component set to desired size but it dint worked.

Can you think some solution for this?