I use MainWindow (JFrame) with JPanel, using simple CardLayout, CardLayout is filled with some JPanels.
It works fine if I drag and drop JPanels from the palette into CardLayout and then place the contents in the panels. However, I want to place different JPanels in separate files, so I created some JPanel forms with NetBeans.
The only problem I have now is when I put my JPanel derived class in CardLayout (for example, using the Select Bean function from NetBeans). NetBeans always sets a new layout for the panel, so my initial layout from the JPanel class becomes overridden, and all I get is an empty JPanel.
So does anyone know if there is a way to just remove the layout from my JPanel classes? I mean, I cannot set the layout to No or something in NetBeans, if I set it to Null Layout, it still calls jPanel.setLayout (null); but I just don't want to call setLayout at all, is it possible?
And sorry if I'm just stupid to find a solution here. I am new to NetBeans, but there must be a way to manually change the code, I canโt just use the "Customize code" option because it says "// Subcomponent code and layout - not shown here" ...
I hope someone understands that my problem is here. :)
source share