Switching between panels -- CardLayout??
843805Nov 25 2006 — edited Nov 26 2006I'm a newbie with Java and have bitten off more than I can chew. I have an application that has many panels switch I've been switching between using the following code (just included the snippet where I change panels):
JPanel test = new CustomerPanel();
this.removeAll();
this.setBounds(0,0,getWidth(), getHeight());
this.repaint();
this.add(test);
Thing is two of my panels are different colors and every time I switch I see the "other" one's color in the corner of the frame. I've tried a bunch of different things to fix it but since I don't have enough knowledge I'm looking for the needle in the haystack. I hate to re-do everything and create a CardLayout but it seems like I may need to. My problem is I looked at the Sun tutorial on CardLayouts and when I tried to play with it I couldn't get either panel to display in my designer (I'm using JBuilder 2005). Any ideas on either issue?