case NORTH_EAST:
case Cursor.NE_RESIZE_CURSOR:
    public void mouseDragged(MouseEvent e)    {      // If the frame is maximized, there is nothing that      // can be dragged around.      if (frame.isMaximum())        return;      DesktopManager dm = getDesktopManager();      Rectangle b = frame.getBounds();      Dimension min = frame.getMinimumSize();      if (min == null)        min = new Dimension(0, 0);      Insets insets = frame.getInsets();      int x = e.getX();      int y = e.getY();      if (e.getSource() == frame && frame.isResizable())        {          switch (direction)            {            case NORTH:              cacheRect.setBounds(b.x, Math.min(b.y + y, b.y + b.height                                                         - min.height),                                  b.width, b.height - y);              break;            case NORTH_EAST:              cacheRect.setBounds(b.x, Math.min(b.y + y, b.y + b.height                                                         - min.height), x,                                  b.height - y);              break;            case EAST:              cacheRect.setBounds(b.x, b.y, x, b.height);              break;            case SOUTH_EAST:              cacheRect.setBounds(b.x, b.y, x, y);              break;            case SOUTH:              cacheRect.setBounds(b.x, b.y, b.width, y);              break;            case SOUTH_WEST:              cacheRect.setBounds(Math.min(b.x + x, b.x + b.width - min.width),                                  b.y, b.width - x, y);              break;            case WEST:              cacheRect.setBounds(Math.min(b.x + x, b.x + b.width - min.width),                                  b.y, b.width - x, b.height);              break;            case NORTH_WEST:              cacheRect.setBounds(                                  Math.min(b.x + x, b.x + b.width - min.width),                                  Math.min(b.y + y, b.y + b.height - min.height),                                  b.width - x, b.height - y);              break;            }          dm.resizeFrame(frame, cacheRect.x, cacheRect.y,                         Math.max(min.width, cacheRect.width),                         Math.max(min.height, cacheRect.height));        }      else if (e.getSource() == titlePane)        {          Rectangle fBounds = frame.getBounds();          frame.putClientProperty("bufferedDragging", Boolean.TRUE);          dm.dragFrame(frame, e.getX() - xOffset + b.x, e.getY() - yOffset                                                        + b.y);        }    }