public Dragger(JFrame f) {
        frame = f;
        setOpaque(false);
        setLayout(new BorderLayout());
        add(title, BorderLayout.CENTER);
        setBorder(new EmptyBorder(0, 10, 0, 10));
        addMouseMotionListener(new MouseMotionAdapter() {
            public void mouseDragged(MouseEvent e) {
                frame.setLocation(e.getX() + frame.getX() - x,
                        e.getY() + frame.getY() - y);
            }
        });
        addMouseListener(new MouseListener() {
            public void mousePressed(MouseEvent e) {
                x = e.getX();
                y = e.getY();
            }
            public void mouseClicked(MouseEvent e) {}
            public void mouseEntered(MouseEvent e) {}
            public void mouseExited(MouseEvent e) {}
            public void mouseReleased(MouseEvent e) {}
        });
    }