mousedragged lags/skip when moving window/frame/program
<p>I have my program undecorated, because of this I still want to move the program without a title bar. The code below for me does work, but it like lags or skips. It does work fine for a second the skips, works fine, skips... etc etc. Currently I have my if statement in the mousemoved off. Is there a better way to implement a mousedragged to move my window/frame/program?</p>

<pre><code>addMouseMotionListener(new MouseMotionListener() {                  

            @Override
            public void mouseDragged(final MouseEvent e) {
                // TODO Auto-generated method stub
                Runnable runnable = new Runnable() {
                    public void run() {
                        int posX=0;
                        int posY=0;
                        int posx=e.getLocationOnScreen().x;
                        int posy=e.getLocationOnScreen().y;
                        setLocation (posx - posX, posy - posY);
                    }};
                   SwingUtilities.invokeLater(runnable);                                       
                }


                public void mouseMoved(MouseEvent e) {
                    // TODO Auto-generated method stub
                    if (SettingsIni.jmenuauto().equals("on")){
                        getJMenuBar().setVisible(e.getY() &lt; 50);
                    }
                }           

            });
</code></pre>
