Java JDesktopPane moveOff(JDesktopPane desktop)

Here you can find the source of moveOff(JDesktopPane desktop)

Description

move Off

License

Apache License

Declaration

public static void moveOff(JDesktopPane desktop) 

Method Source Code


//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
            }
        }
    }
}

Related

  1. arrangeIcons(JDesktopPane desktop)
  2. arrangeMinifiedWindows(JDesktopPane desktop)
  3. cascade(JDesktopPane desktopPane, int layer)
  4. makeCenter(JDesktopPane desktop)
  5. tileHorizontal(JDesktopPane desktop)
  6. tileVertical(JDesktopPane desktop)