The problem
I would like to know whether it is possible to make a JFrame not movable/draggable - just out of curiosity and not for a real use case. The problem is that the window manager of the operating system is responsible for the appearance of the windows, but the program itself has only a few possible settings. This is why I am looking for a hack.
What I have tried
- removed the decoration of the
JFrameas stated in this answer (however, it is still possible to move the window, e.g. by holding the ALT key on GNU/Linux) - set a
ComponentListenerwhich resets the position if theJFrameis moved (however, this looks very glitchy since the listener only reacts after the dragging, but theJFrameshould always stay at the same position) - created a full screen
JFrame, made it transparent and added aJPanelto simulate a window (however, one can still drag the window, even if it is maximized) - used a
JWindowand aJDialoginstead (also does not work)
Is there any way to achieve the desired behavior by using a different approach or improving one of my approaches?
Works for me.