setContentPane to change pages
I have an application with several pages of a form, and I get to the next page by entering the details and clicking the continue button. The ActionListener on the continue button validates that part of the form and then uses parentGui.setContentPane(nextPage) to get to the next page where parentGui is derived from JFrame and nextPage is derived from JPanel.
However, the next page is not painted unless I resize the window. Even if I call parentGui.repaint() the whole frame just goes white until I resize the window.
Is there something I am missing, should I be trying to do this a different way (I can get it working with a JTabbedPane but I don't really want the tabs at the top, just a collection of JPanels that I can switch between).
[761 byte] By [
Ghelyara] at [2007-11-26 18:22:38]

# 1
> I have an application with several pages of a form,
> and I get to the next page by entering the details
> and clicking the continue button. The ActionListener
> on the continue button validates that part of the
> form and then uses parentGui.setContentPane(nextPage)
> to get to the next page where parentGui is derived
> from JFrame and nextPage is derived from JPanel.
>
> However, the next page is not painted unless I resize
> the window. Even if I call parentGui.repaint() the
> whole frame just goes white until I resize the
> window.
>
> Is there something I am missing, should I be trying
> to do this a different way (I can get it working with
> a JTabbedPane but I don't really want the tabs at the
> top, just a collection of JPanels that I can switch
> between).
See java.awt.CardLayout