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 73463

Summary: Make Free Design support layers with JLayeredPane
Product: guibuilder Reporter: _ gtzabari <gtzabari>
Component: CodeAssignee: issues@guibuilder <issues>
Status: NEW ---    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 184571    
Bug Blocks:    
Attachments: example form with JLayeredPane
example form with JLayeredPane (the java file)

Description _ gtzabari 2006-03-10 03:12:13 UTC
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.
Comment 1 _ gtzabari 2011-04-26 20:00:38 UTC
This issue is over 5 years old. Please recommend a workaround or consider fixing it in the next version.
Comment 2 Tomas Pavek 2012-08-29 15:48:03 UTC
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.
Comment 3 unai 2013-02-28 00:49:07 UTC
@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.
Comment 4 Tomas Pavek 2013-06-04 16:21:29 UTC
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.
Comment 5 Tomas Pavek 2013-08-13 15:39:16 UTC
Created attachment 138646 [details]
example form with JLayeredPane
Comment 6 Tomas Pavek 2013-08-13 15:39:58 UTC
Created attachment 138647 [details]
example form with JLayeredPane (the java file)
Comment 7 Tomas Pavek 2013-08-13 16:59:11 UTC
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.)