Search code examples
javaswingmiglayoutjlayeredpane

When using MigLayout, how would a 3rd int parameter to `add` affect layout?


For example:

layeredPane.setLayout(new MigLayout());
layeredPane.add(component, "pos 50 50, width 100, height 100", 0);

The 0 in this case does affect the component's layering, but I can't seem to figure out exactly how. I would like to overlay components, but because there is the second layout constraint for the MigLayout, I can't combine layering and positioning as usual with a JLayeredPane. Thanks


Solution

  • JLayeredPane haven't got implemented LayoutManager then there you have to setBounds or setSize by default, first parameter in constructor is used for JComponents, second for Type of Layer,