Share this page 

Detect which card is visible with a CardLayoutTag(s): AWT


Component getComponentShowing(Container c) {
   Component[] comps = c.getComponents();
   int i = 0;
   while(i < comps.length && !comps[i].isVisible())
      ++i;
   return (i == comps.length) ? null : comps[i];
   }