Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Refresh Panels w/new Content.???

807601Jun 30 2008 — edited Jul 1 2008
Hey fellows, I have a few panels in one frame: jpAll, jpMain and jpBottom.

I'm trying to figure out how to click a button in jpBottom and update the content in jpMain?? So far the only way I've figured is to kill the current frame and open a new frame...I don't like that idea.

Currently, what I have tried for that button's event handler (jbtNext) is assigning jpMain to null and then trying whatever I thought would refresh the panel's content (repaint(), jpMain.validate, jpMain.setVisible()).
public void actionPerformed(ActionEvent e)
 {                
                if (e.getSource() == jbtNext)
                {
                    jpMain = null;
                    repaint();
                    jpMain.validate();
                    jpMain.doLayout();
                    jpMain.setVisible();

                }
}
Lastly, I tried overriding the paintComponent() method and copying some of the code above (such as jpMain.validate()), and I got the same results.

I'm having a hard time finding comprehensive work/books about GUIs. Feel free to suggest books thx.

Edited by: djpme on Jun 30, 2008 4:57 PM

Edited by: djpme on Jun 30, 2008 4:58 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 29 2008
Added on Jun 30 2008
12 comments
50 views