Java tutorial
//package com.java2s; import java.awt.Component; import javax.swing.JDesktopPane; import javax.swing.SwingUtilities; public class Main { /** * Returns the JDesktopPane of the specified Component. <br /> * * @param c the component * @return the JDesktopPane for the component */ public static JDesktopPane getDesktop(Component c) { return (JDesktopPane) SwingUtilities.getAncestorOfClass(JDesktopPane.class, c); } }