Making JTable look more at home on Mac OS and GNOME 2

Back in 2006, I explained how to make JTable look more at home on Mac OS and GNOME. Since then, Mac OS 10.5 added support for the smaller-sized combo boxes I bemoaned the lack of back then, and I updated the code in Subversion to take advantage of that, but didn't make another post.

At the beginning of July, Rob Ross mailed me to say he'd found a work-around for a problem visible in the screenshot in the original post: the unwanted focus ring around the scroll pane. In his own words:

I discovered that this method would add a Border to the enclosing JScrollPane if the scroll pane's border was null. Well, I had already explicitly set that border to null in an attempt to get rid of it. But when the JTable becomes displayable, this method gets called, and re-installs the default focus border.

So all you have to do in your code is re-set the border on the scroll pane to null, and that focus rectangle goes away!

I was my usual slow-to-answer self, but despite my accidental rudeness, I got another mail from Rob later in July with a follow-up:

I have been informed by some Sun Swing guys that the "canonical" way to handle this is to set an EmptyBorder on the [JScrollPane] when it's created; that way a border will not be added ... and no overriding of configureEnclosingScrollPane() is required for this particular issue, although you would still need to override it to get the other effects you're implementing.

The trouble with the Swing guys' suggestion is that, although you avoid having to subclass JTable, you have to fix every JScrollPane you use to contain a JTable. And as Rob rightly says, I still need to subclass JTable to fix the other problems.

Given that, I've committed Rob's first suggestion. See the latest src/e/gui/ETable.java for the whole thing.