title: Drag undecorated jDialog
body: <p>So, I have a jFrame in which I'm building the main interface window of a chat. This window/jFrame has several buttons , each of which show a jDialog (Which I created previously in Netbeans dragging a jDialog onto the parent(?) jFrame).</p>
  
  <p>My problem is that both windows are set to <code>undecorated = true</code> and so I wish to let the user drag and move all windows at will by clicking and dragging a portion of the windows (Which emulate the title bar when not undecorated)</p>
  
  <p>In all the jFrames I have accomplished this by the following code just after <code>initComponents()</code>:</p>
  
  <pre><code>    final Point point = new Point(0,0);        // Why 'final' and not simply Point point?     
      addMouseListener(new MouseAdapter() {  
          public void mousePressed(MouseEvent e) {  
              if(!e.isMetaDown()){  
                  point.x = e.getX();  
                  point.y = e.getY(); 
                  System.out.println("Ratón pulsado: " + point.x + "," + point.y);
              }  
          }  
      });
  
      addMouseMotionListener(new MouseMotionAdapter() {  
          public void mouseDragged(MouseEvent e) {  
              if(!e.isMetaDown() &amp;&amp;  point.y &lt;= 17){  //Coordinates of title bar, any X and up to 17px from the top border
                  Point p = getLocation();  
                  setLocation(p.x + e.getX() - point.x, p.y + e.getY() - point.y); 
                  System.out.println("Ratón movido: " + (p.x + e.getX() - point.x) + "," + (p.y + e.getY() - point.y));
              }  
          }  
      }); 
  </code></pre>
  
  <p>However, I don't know how to use this code in the jDialog. When I right click it in the Navigator, and select Customize code, then I can't paste it in there because the whole jFrame stops working. I'm new in this thing of jDialogs children of jFrames, so please help me with some guidelines :) Thanks</p>