i used setundecorated(true); to remove the buttons and border of the window,,the problem is the frame only stays where it is, because the title bar is removed i cant drag it around the screen anymore..

what code should i add to be able to drag it anywhere in the scree without removing the setundecorated(true);??

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

public class emptyframe extends JFrame implements ActionListener{

	private JButton JB = new JButton("button");

    public emptyframe()





    public void actionPerformed(ActionEvent e)


    	private void frameformat()
		  setPreferredSize (new Dimension (582, 336));
		  setLayout (null);
		  setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);


    public static void main (String[] args) {

        new emptyframe().setVisible(true);


What are you trying to achieve by making your JFrame undecorated? If you wish to remove the user's ability to resize the window, you can use the setResizable() method to stop them from doing this (which you have done). If you want to stop the user from closing the window, you can use the setDefaultCloseOperation() method to set the window to DO_NOTHING_ON_CLOSE. If you really want to remove the border, then I don't think you will be able to move the window, at least without some serious manipulation of the look and feel of your window.