How to remove the borders of a JFrame?

21

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 Lucas Carezia 29.07.2015 в 23:01

1 answer

2

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