public void mouseReleased (MouseEvent e){
        Container parent = e.getComponent().getParent();
        if(SwingUtilities.isLeftMouseButton(e) && dragging && parent != null){
            Rectangle bounds = e.getComponent().getBounds();
            boolean setBounds = false;
            
            for (int i = 25; i<parent.getWidth(); i += 125){
                for(int j = 25; j<parent.getHeight(); j += 100){
                    Rectangle cell = new Rectangle(i, j, 100, 75);
                    if(cell.intersects(bounds)){
                        Rectangle intersection = cell.intersection(bounds);
                        if(intersection.width*intersection.height >= bounds.width*bounds.height / 8){
                            e.getComponent().setBounds(cell);
                            setBounds = true;
                            break;
                        }
                    }
                }
                if(setBounds){
                    break;
                }
            }
            
            e.getComponent().setBounds(bounds);

            if(e.getComponent() instanceof JComponent){
                ((JComponent) e.getComponent()).putClientProperty(DRAGGED_MARK, null);
            }
            dragging = false;
        }
    }