Can heavyweight components reside under JXLayer?
I just tried putting a heavyweight component on a JPanel and then wrapping the JPanel with JXLayer. This will not work.
Unless I call setLayout and setView on the JXLayer. But this somehow messes up my JXLayer functionalities as well, so it's not really a workaround for me.
I saw this bug, but validating the frame doesn't fix the problem for me.
The code that fails is below, is JXLayer maybe not supposed to handle heavyweights components in it's children?
Thanks to anybody that can clarify this for me.
public class HWTest extends JPanel
Canvas canvas = new Canvas();
JPanel canvasPanel = new JPanel(new BorderLayout());
JXLayer jxLayer = new JXLayer(canvasPanel);
//the two commented out lines fix the problem, but disturb the JXLayer also in some way.
// jxLayer.setLayout(new BorderLayout());
public static void main(String args)
catch (Exception e)
final JFrame testFrame = new JFrame("Test");
testFrame.add(new HWTest(), BorderLayout.CENTER);
public void run()