Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: Remove title bar buttons only

I've only found ways to completely remove title bar + borders. I want to create a window in Swing without title bar buttons but still retain the default system's border. Is this possible?

like image 264
Mintz Avatar asked Dec 11 '22 20:12

Mintz


2 Answers

The following link has a complete working example that uses remove() on the buttons:

http://www.coderanch.com/t/344419/GUI/java/deactivate-close-minimise-resizable-window

like image 124
PeakGen Avatar answered Jan 02 '23 18:01

PeakGen


You can use the frame's setUndecorated() method and render your own decorations. You may want to leverage the JInternalFrame UI defaults, which typically recapitulate those of the platform's default Look & Feel, as shown here. These seem especially relevant:

InternalFrame.activeTitleBackground
InternalFrame.activeTitleForeground
InternalFrame.inactiveTitleBackground
InternalFrame.inactiveTitleForeground
like image 44
trashgod Avatar answered Jan 02 '23 20:01

trashgod