I have an application that has a BorderLayout
. In the Center of this layout I have a JPanel
that is called mainContent.
Now I have a method like this:
public void setMainPanel(JPanel panel){
mainPanel = panel;
gui.repaint();
gui.revalidate();
}
Here I can set the reference from the mainPanel
to a new panel, but it's not possible to make it visible! So I have no idea how I can refresh the GUI!
I tried repaint
and revalidate
! The variable GUI is the JFrame
! The setMainPanel
method is defined in the frame Class.
How can I refresh/repaint the content?