I currently wrote Java Swing with help JFrame, and it works great.
But now I need to use several screens, and they are executed using cardlayouts.
So I need to convert my JFrameto JPanel. I currently have this line for myJFrame
mainFrame.getContentPane().add(c4Panel,BorderLayout.CENTER);
But if I convert mainFrameto JPanel, I canβt use the getContentPane()IDE tells me to usegetRootPane()
but I get an error in this line
mainPanel.getRootPane().add(c4Panel,BorderLayout.CENTER);
The error I get is
Exception in thread "main" java.lang.NullPointerException
source
share