Here you can find the source of moveOff(JDesktopPane desktop)
public static void moveOff(JDesktopPane desktop)
//package com.java2s; //License from project: Apache License import java.awt.Component; import java.awt.Container; import java.awt.event.MouseMotionListener; import javax.swing.JDesktopPane; import javax.swing.JInternalFrame; import javax.swing.plaf.basic.BasicInternalFrameUI; public class Main { public static void moveOff(JDesktopPane desktop) { JInternalFrame[] frames = desktop.getAllFrames(); for (JInternalFrame frame : frames) { BasicInternalFrameUI ui = (BasicInternalFrameUI) frame.getUI(); Component northPane = ui.getNorthPane(); Container north = (Container) ui.getNorthPane(); MouseMotionListener[] motionListeners = (MouseMotionListener[]) northPane .getListeners(MouseMotionListener.class); for (MouseMotionListener listener : motionListeners) { northPane.removeMouseMotionListener(listener); north.remove(0);//from ww w . j a v a 2s .c om } } } }