1 2 package org.webdocwf.util.loader.wizard; 3 4 import javax.swing.*; 5 import java.awt.*; 6 7 public class SampleDesktopMgr extends DefaultDesktopManager { 8 9 public void dragFrame(JComponent f, int x, int y) { 12 if (f instanceof JInternalFrame) { JInternalFrame frame = (JInternalFrame)f; 14 JDesktopPane desk = frame.getDesktopPane(); 15 Dimension d = desk.getSize(); 16 17 if (x < 0) { x = 0; } 22 else { 23 if (x + frame.getWidth() > d.width) { x = d.width - frame.getWidth(); } 26 } 27 if (y < 0) { y=0; } 30 else { 31 if (y + frame.getHeight() > d.height) { y = d.height - frame.getHeight(); } 34 } 35 } 36 37 super.dragFrame(f, x, y); 39 } 40 } 41 | Popular Tags |