This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 184571 - Support JLayeredPane as layout container
Summary: Support JLayeredPane as layout container
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P2 normal with 2 votes (vote)
Assignee: issues@guibuilder
: 73464 (view as bug list)
Depends on:
Blocks: 73463 136425
  Show dependency tree
Reported: 2010-04-20 19:09 UTC by charlweed
Modified: 2013-05-09 02:37 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description charlweed 2010-04-20 19:09:03 UTC
JLayeredPane supports layouts the same way as JPanel. So It would be good to use the guibuilder to layout components in JLayeredPane, the same way as JPanels can be.

I have cut and pasted NB generated layout code, and substituted JLayerdPane for JPanel, and I have not yet ever encountered and error. Of course, this is a very clumsy way to do layout. 

One could argue that Layouts should be supported for all Swing containers, but JLayerdPane is a sensible first step.
Comment 1 Jan Stola 2010-04-22 08:39:39 UTC
I agree that it would be nice to support layout manager setting for JLayeredPane.
Comment 2 Jan Stola 2010-04-22 08:40:32 UTC
*** Bug 73464 has been marked as a duplicate of this bug. ***
Comment 3 unai 2013-02-28 00:44:01 UTC
For the love of God please do that, it is clearly a defect.

As of 2013, NB's GUI editor doesn't allow to set a layout (say, BorderLayout, or GridBagLayout) to JLayeredPanes.

The applications would be endless.
Suppose you have a map that spans the entire height and width of the JLayeredPane and, on top of that, you would like to place a semitransparent compass, anchored to the top right, fixed size.

As of now you simply can't, you have to hand-code it (so you won't have a WYSIWYG preview, but a mixed drag&drop-built and code-built UI).

You can do that with a normal JPanel but not with a layered pane!
The way I see it, with the current state of Matisse, having a JLayeredPane in NB's palette is kinda useless...
Comment 4 Tomas Pavek 2013-05-06 16:14:49 UTC
Implemented the possibility to use any layout manager in JLayeredPane. Each component in JLayeredPane now has the Layer property in addition to the layout constraints for given layout manager.

To make this useful there need to be suitable layout managers that can place components over each other. Looks like the only usable is GridBagLayout at this moment (from the standard layout managers). It allows to define overlapping components and their visibility can be controlled well by the JLayeredPane's layer.

BorderLayout does not seem usable - it allows to place multiple components into the same slot, but it only lays out the last added component (the other have zero position/size).

There is also bug 73463 that requests Free Design mode to support layers (now arranging overlapping components is very limited and not really supported there).

Then it would be nice to support OverlayLayout (it did not make much sense without JLayeredPane so we don't have it yet).
Comment 5 Tomas Pavek 2013-05-06 19:55:24 UTC
Also added support for OverlayLayout:
Comment 6 Quality Engineering 2013-05-09 02:37:21 UTC
Integrated into 'main-golden', will be available in build *201305082300* on (upload may still be in progress)
User: Tomas Pavek <>
Log: #184571: allowing to use JLayeredPane with any layout