java - How to fire an event when JTable is visible? -


i know whether jtable not responding componentlistener. have jtable inside tab of jtabbedpane, , have implemented componentlistener jtable can fire when table visible. but, not responding!i noticed not responding jtabbedpane well! ideas how can find whether jtable visible?

how can find whether jtable visible?

source: determines if component visible in window @ given screen location.

import java.awt.component; import java.awt.point; import java.awt.window;  import javax.swing.jrootpane; import javax.swing.swingutilities;   /**  * class contains collection of static utility methods swing.  *   * @author heidi rakels.  */ public class swingutil {     /**      * <p>    * determines if component visible in window @ given screen location.    * </p>    *    * @param   location  location on screen.    * @param   component  component in window.    * @return        true if component visible in window @ given screen location.    */   public static boolean locationincomponentvisible(point location, component component)   {      // root component in window.     jrootpane rootpane = getrootpane(component);     if (rootpane != null)     {       component rootcomponent = rootpane.getcontentpane();       if (rootcomponent != null)       {         // location relative root component.         point locationinroot = new point(location);         swingutilities.convertpointfromscreen(locationinroot, rootcomponent);          // deepest visible component @ given location.         component deepestcomponent = swingutilities.getdeepestcomponentat(rootcomponent, locationinroot.x, locationinroot.y);         if (deepestcomponent != null)         {           boolean result = swingutilities.isdescendingfrom(deepestcomponent, component);           return result;         }       }     }      return false;    }   /**    * gets root pane of given component.    *     * @param   component    component root pane retrieved.    * @return           root pane of component.    */   public static jrootpane getrootpane(component component)   {      if (component instanceof jrootpane) {       return (jrootpane)component;     }     if (component.getparent() != null) {       return getrootpane(component.getparent());     }      // window of component.     window window = swingutilities.windowforcomponent(component);     return getrootpane(window);      } } 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -