I've implemented a custom swing component. It extends the JComponent
class and implement paintComponent.
If I add this comonent to a panel with a BorderLayout layoutmanager, it
is show. If I use the default layoutmanager for JPanels (flowlayout),
the panel is paintet over my component. And also, if I specify
BorderLayout.NORTH when adding my componenet to the JPanel, the
component is also overpainted.
The reason I know its overpainted is because I have a System.out.println
statement int he paintComponent function, and I can see the print out
when its repaintet.
So the question is, how do I implement support for posisioning by
layoutmanagers in my component.
Glenn
> I've implemented a custom swing component. It extends the JComponent
> class and implement paintComponent.
>
> If I add this comonent to a panel with a BorderLayout layoutmanager, it
> is show. If I use the default layoutmanager for JPanels (flowlayout),
> the panel is paintet over my component.
It sounds more like your component is assigned no space.
What do you return for
<http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#getPreferredSize()>
&
<http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#getMinimumSize()>
?
> So the question is, how do I implement support for posisioning by
> layoutmanagers in my component.
Generally, return reasonable values for the above and allow
the layout manager to do its job.
Failing that, post an SSCCE.
<http://www.physci.org/codes/sscce.jsp>

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane