Java tutorial
//package com.java2s; import javax.swing.JComponent; import javax.swing.JInternalFrame; public class Main { public static JInternalFrame getInternalFrameForComponent(JComponent c) { java.awt.Container p = c; do { if (p instanceof JInternalFrame) { return (JInternalFrame) p; } p = p.getParent(); } while (p != null); return null; } }