How to remove the borders of a JFrame?


I'd like to remove the borders of a JFrame . I used setUndecorated(true) , however it completely removes and I would like to just leave the title bar of JFrame .

asked by anonymous 29.07.2015 / 23:01

1 answer


The window borders are provided by the operating system (as long as the window is marked as decorated). The window decoration includes the title bar so you can not have one thing without having the other.

There is a way to do it: you can set your window as undecorated and implement a title bar at hand. The problem is that you would have to make the buttons maximize, minimize and close yourself, worrying about the correct positioning of them (in Mac OS and Ubuntu is different from Window). Not to mention what I would have to do in the hand that this bar responds to drag and drop. That is, it's not worth it (but the Chrome folks did!)

26.10.2015 / 19:55