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];
   }



If you find this article useful, consider making a small donation
to show your support for this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2012
[ home ]