In case this is of interest: the Quaqua Look and Feel uses a client property named "Quaqua.Component.visualMargin" with a default value of Insets(3,3,3,3).
With the insets of 3,3,3,3 the bounds of JComponent accommodate its visual bounds (the button border or the text field border), as well as cast shadows and focus ring.
By setting the insets to 0,0,0,0 the visual bounds of the component touch the bounds of the JComponent. Cast shadows and focus ring are cut off. This allows to place two components next to each other, so that their visual bounds touch.
Swing actually does support overlapping components by placing the components into a JLayeredPane, or by overriding method isOptimizedDrawing enabled of a JPanel (or whatever the parent JComponent is) so that it returns false.
This allows to use gaps between components which are smaller than 6 pixels, even if the visual margin insets is set to 3,3,3,3.
By providing the "Quaqua.Component.visualMargin" developers can choose whether they want to place components very close together by reducing the insets and cutting of some artwork, or by keeping the insets and letting the components slightly overlap.
With best regards,
Werner
On 30.09.2008, at 18:00, Mike Swingler wrote:
Yeah, I mean, we could adjust the borders in Aqua if the button were both setFocusPainted(false) and setFocusable(false), but that still might catch some people by surprise. I figure if you are opting into the special button styles using a client property, there isn't much harm in using another one to hint that the insets should change too.
Ideally, if focus indicators had their own dedicated layer they were drawn in, or a component could dirty outside of it's bounds without causing infinite loops, we wouldn't have to make the component big enough to accommodate both the control and it's focus area - but I digress.