Component[] children;
if(parent instanceof JLayeredPane) {
JLayeredPane layeredPane = (JLayeredPane)parent;
List<Component> childList = new ArrayList<Component>(layeredPane.getComponentCount() - 1);
int layer = c == null? Integer.MIN_VALUE: layeredPane.getLayer(c);
for(int i=layeredPane.highestLayer(); i>=layer; i--) {
Component[] components = layeredPane.getComponentsInLayer(i);
for(Component child: components) {
if(child == c) {
break;
}