You need to step back and understand how Swing works.
When you create a JFrame, Swing uses the OS widget for the frame. The title bar that you see is part of the OS component and you do not have direct control over it with Swing. You can hide the title (and border) of the frame using setUndecorated (false), as suggested earlier. In this case, you will lose all the functionality associated with the title (drag and drop and access to all buttons) and border (resize). Therefore, if you need any of these functions, you need to recreate it all yourself.
Alternatively, you can use:
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame();
Swing Border . , , JFrame , , . , MouseMotionListeners , . , , , . , .
, JInternalFrame - , Swing, , , JFrame.