> Have you tried giving it a RaisedBevelBorder?
Borders are intended for Component decoration. Rectangle, however, is
basically a Shape. You can abuse most Border implementations and
convince them to paint on an arbitrary location on some JPanel's
Graphics2D context. You have to provide some fake Component. However,
this usually only works, because the Border implementations don't
interact much with the Component. But this is an implementation details,
and Sun might at any point in time decide to do things differently.
Therefore I wouldn't use a Border. Instead I would paint the two to
three lines per side myself.
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
John McGrath - 09 May 2005 19:26 GMT
> > Have you tried giving it a RaisedBevelBorder?
>
> Borders are intended for Component decoration. Rectangle, however, is
> basically a Shape.
Yes, I did not read the question carefully and I was thinking he was
talking about a component, not a Shape.
Still, I would recommend looking at a raised BevelBorder and other Border
classes to find one that provides the desired effect, and then look at the
source code to see how to implement the effect.

Signature
Regards,
John McGrath
Remi Bastide - 10 May 2005 08:02 GMT
>> Have you tried giving it a RaisedBevelBorder?
>
[quoted text clipped - 10 lines]
>
>/Thomas
What about graphics.fill3DRect(...) ?
John McGrath - 11 May 2005 15:45 GMT
> What about graphics.fill3DRect(...) ?
That works, but not very well, IMO. The Graphics context only contains
a single color, so the draw/fill 3D operations need to derive multiple
colors from the current color using operations like the Color darker()
and brighter() methods. I find it works much better if you choose the
colors yourself and draw the individual lines.

Signature
Regards,
John McGrath