java - When to create a Panel for CardLayout? -
i use cardlayout mvc , try understand, when should create panels used cardlayout.
for example:
a detailpanel view , edit details of dataitem shown, when select dataitem on listpanel. should create , show detailpanel when select dataitem, or should create detailpanel @ start of application , call load method, when select dataitem, , show detailpanel?
currently i'm using cardlayout stack. add panel when need , remove when i'm done editing.
try avoid replacing view components. initially, create of detailpanel
possible , update component models in listselectionlistener
. use cardlayout
variable portion of each detailpanel
. it's unlikely creating view have perceptible performance impact; profile see. if find constructing model introduces significant latency, consider swingworker
, illustrated here , here.
Comments
Post a Comment