+ class MyDesktopManager implements DesktopManager
+ {
+
+ private DesktopManager delegate;
+
+ public MyDesktopManager(DesktopManager delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public void activateFrame(JInternalFrame f)
+ {
+ try
+ {
+ delegate.activateFrame(f);
+ } catch (NullPointerException npe)
+ {
+ Point p = getMousePosition();
+ instance.showPasteMenu(p.x, p.y);
+ }
+ }
+
+ public void beginDraggingFrame(JComponent f)
+ {
+ delegate.beginDraggingFrame(f);
+ }
+
+ public void beginResizingFrame(JComponent f, int direction)
+ {
+ delegate.beginResizingFrame(f, direction);
+ }
+
+ public void closeFrame(JInternalFrame f)
+ {
+ delegate.closeFrame(f);
+ }
+
+ public void deactivateFrame(JInternalFrame f)
+ {
+ delegate.deactivateFrame(f);
+ }
+
+ public void deiconifyFrame(JInternalFrame f)
+ {
+ delegate.deiconifyFrame(f);
+ }
+
+ public void dragFrame(JComponent f, int newX, int newY)
+ {
+ if (newY < 0)
+ {
+ newY = 0;
+ }
+ delegate.dragFrame(f, newX, newY);
+ }
+
+ public void endDraggingFrame(JComponent f)
+ {
+ delegate.endDraggingFrame(f);
+ }
+
+ public void endResizingFrame(JComponent f)
+ {
+ delegate.endResizingFrame(f);
+ }
+
+ public void iconifyFrame(JInternalFrame f)
+ {
+ delegate.iconifyFrame(f);
+ }
+
+ public void maximizeFrame(JInternalFrame f)
+ {
+ delegate.maximizeFrame(f);
+ }
+
+ public void minimizeFrame(JInternalFrame f)
+ {
+ delegate.minimizeFrame(f);
+ }
+
+ public void openFrame(JInternalFrame f)
+ {
+ delegate.openFrame(f);
+ }
+
+ public void resizeFrame(JComponent f, int newX, int newY, int newWidth,
+ int newHeight)
+ {
+ Rectangle b = desktop.getBounds();
+ if (newY < 0)
+ {
+ newY = 0;
+ }
+ delegate.resizeFrame(f, newX, newY, newWidth, newHeight);
+ }
+
+ public void setBoundsForFrame(JComponent f, int newX, int newY,
+ int newWidth, int newHeight)
+ {
+ delegate.setBoundsForFrame(f, newX, newY, newWidth, newHeight);
+ }
+
+ // All other methods, simply delegate
+
+ }
+