java - CardLayout - how to change name of component -
is there way change name of panel added panel cardlayout? want use show
method without having use name gave panel when added main panel.
jpanel panel = new jpanel(); add(panel, "0"); show(this, "0"); ... // change name of panel "1" show(this, "1"); // can show panel
// original cardpanel1 name "card1" cardlayout lay = (cardlayout)parentpanel.getlayout(); lay.removelayoutcomponent(cardpanel1); lay.addlayoutcomponent(cardpanel1, "card4"); // cardpanel1 can shown using "card4" name
Comments
Post a Comment