1950 } 1951 1952 static void updateRendererOrEditorUI(Object rendererOrEditor) { 1953 if (rendererOrEditor == null) { 1954 return; 1955 } 1956 1957 Component component = null; 1958 1959 if (rendererOrEditor instanceof Component) { 1960 component = (Component)rendererOrEditor; 1961 } 1962 if (rendererOrEditor instanceof DefaultCellEditor) { 1963 component = ((DefaultCellEditor)rendererOrEditor).getComponent(); 1964 } 1965 1966 if (component != null) { 1967 SwingUtilities.updateComponentTreeUI(component); 1968 } 1969 } 1970 } | 1950 } 1951 1952 static void updateRendererOrEditorUI(Object rendererOrEditor) { 1953 if (rendererOrEditor == null) { 1954 return; 1955 } 1956 1957 Component component = null; 1958 1959 if (rendererOrEditor instanceof Component) { 1960 component = (Component)rendererOrEditor; 1961 } 1962 if (rendererOrEditor instanceof DefaultCellEditor) { 1963 component = ((DefaultCellEditor)rendererOrEditor).getComponent(); 1964 } 1965 1966 if (component != null) { 1967 SwingUtilities.updateComponentTreeUI(component); 1968 } 1969 } 1970 1971 /** 1972 * Retrieves the validate root of a given container. 1973 * 1974 * If the container is contained within a {@code CellRendererPane}, this 1975 * method returns {@code null} due to the synthetic nature of the {@code 1976 * CellRendererPane}. 1977 * <p> 1978 * The component hierarchy must be displayable up to the toplevel component 1979 * (either a {@code Frame} or an {@code Applet} object.) Otherwise this 1980 * method returns {@code null}. 1981 * <p> 1982 * If the {@code visibleOnly} argument is {@code true}, the found validate 1983 * root and all its parents up to the toplevel component must also be 1984 * visible. Otherwise this method returns {@code null}. 1985 * 1986 * @return the validate root of the given container or null 1987 * @see java.awt.Component#isDisplayable() 1988 * @see java.awt.Component#isVisible() 1989 * @since 1.7 1990 */ 1991 static Container getValidateRoot(Container c, boolean visibleOnly) { 1992 Container root = null; 1993 1994 for (; c != null; c = c.getParent()) 1995 { 1996 if (!c.isDisplayable() || c instanceof CellRendererPane) { 1997 return null; 1998 } 1999 if (c.isValidateRoot()) { 2000 root = c; 2001 break; 2002 } 2003 } 2004 2005 if (root == null) { 2006 return null; 2007 } 2008 2009 for (; c != null; c = c.getParent()) { 2010 if (!c.isDisplayable() || (visibleOnly && !c.isVisible())) { 2011 return null; 2012 } 2013 if (c instanceof Window || c instanceof Applet) { 2014 return root; 2015 } 2016 } 2017 2018 return null; 2019 } 2020 } |