@Override
    public void mouseDragged(MouseEvent e) {
        if(Orientation==HORIZONTAL){
            if(parent.getWidth()+e.getX()-pos.x>min){
                if(e.isControlDown())
                    parent.setPreferredSize(
                            new Dimension(round(parent.getWidth()+e.getX()-pos.x),
                            parent.getHeight()));
                else parent.setPreferredSize(
                            new Dimension(parent.getWidth()+e.getX()-pos.x,
                            parent.getHeight()));

            }
        }
        else if(Orientation==VERTICAL){
            if(parent.getHeight()+e.getY()-pos.y>min){
                if(e.isControlDown())
                    parent.setPreferredSize(
                        new Dimension(parent.getWidth(),
                        round(parent.getHeight()+e.getY()-pos.y))
                        );
                else
                    parent.setPreferredSize(
                        new Dimension(parent.getWidth(),
                        parent.getHeight()+e.getY()-pos.y)
                        );
            }
        }
        parent.revalidate();
        //pos=e.getPoint();
    }