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.
dev build 200602281900 When using Matisse layout mode, it is impossible to try to layout components inside a JLayeredPane. When I am moving a component in layer X, Matisse keeps on trying to align it against the position of another component in layer Y that lies under the same (x, y) coordinates. Matisse should only try to "click into place" with respect to components in the same layer as the current component being dragged.
This issue is over 5 years old. Please recommend a workaround or consider fixing it in the next version.
The support for JLayeredPane only works as null layout, not Free Design which is the mode where you could see "trying to align a component against the position of another component". The null layout mode is primitive, just puts components wherever you drop them. There's bug 184571 requesting to allow using any layout manager within JLayeredPane, with the layer specification separate from that. If we had this, we could then consider this enhancement and make the Free Design aware of the layers. For now, if you want separate layers with own layout each, you need to design them as separate panels and then add them with opacity set to false to the JLayeredPane (manually). Doing a multi-layer layout directly in one container is currently not possible, though GroupLayout is capable of supporting that.
@Tomas Problem is that as of now you can't have JLayeredPane's content fill the entire height/width of the JLayeredPane, so we're laying out fixed-sized stuff like it's 1985... I really hope that at least BorderLayout gets to be supported by JLayeredPane in NetBeans.
Note bug 184571 was fixed so now it is possible to use any layout in JLayeredPane. See more comments in the bug 184571. Keeping this report as request for Free Design to support layers (overlapping components) within one container.
Created attachment 138646 [details] example form with JLayeredPane
Created attachment 138647 [details] example form with JLayeredPane (the java file)
The submitted example shows how the JLayeredPane can be used with Free Design today. It contains two layers designed as panels added to the JLayeredPane with OverlayLayout (so the panels overlap entirely). Each of the layers is a separate panel with Free Design, the second one is transparent (opaque false). The limitation is that each layer need to be designed separately in its own panel; when displayed together as the whole form then only the above layer is reachable in the design area - although the underlying layer is visible through it. So when opening the sample form, it's possible to click only the button at bottom right corner (in the second panel/layer). The panel underneath can't be directly accessed - need to use the "Design this Container" action. Ideally the form should be designed in one "Free Design" container with all layers, i.e. allowing to set and distinguish the individual layers of components (and reach all the components) within the same container and use the JLayeredPane for that. (This is already possible with GridBagLayout - the layout properties also include the layer, among the regular grid bag constraints.)