Does anybody have any idea on how to solve this problem?? ? Also if anybody
knows how to use a LayoutManager with JDesktopPane with the requirement
that the JInternalFrames associated with this JDesktopPane behave correctly,
then please inform me how to do so.
Ahmed
> I'm trying to add some components to a JDesktopPane in addition to some
> JInternalFrames such that the JInternalFrames will display in front of these
> components when they are not iconified. The problem is that JDesktopPane's
> layout manger is null and once you set it to any LayoutManager by calling
> setLayoutManager(...), then the JInternalFrames appear on the same layer as
> the other components in the JDesktopPane and will be aligned with them
> according to the chosen LayoutManager's policy (very weird looking).
> <snip>
>
> Does anybody have any idea on how to solve this problem?? ? Also if anybody
> knows how to use a LayoutManager with JDesktopPane with the requirement
> that the JInternalFrames associated with this JDesktopPane behave correctly,
> then please inform me how to do so.
The mechanism that JDesktopPane uses to control its JInternalFrames isn't
compatible with a layout manager. You have to achieve the effect you want
in some other way. I'm guessing that you want a background on the JDP -
if so, you can either add a panel (or, easier, a JLabel with an icon) on the
lowest layer of the JDP, or you can override the paintComponent method
of the JDP itself to draw an image on it (that will resize the image
automatically
for you, whereas with a component you have to listen for resize events and
do it yourself).
Hope this helps
Maurice