Hello Members,

Is there a way to make a JDialog unmovable?

Thank you!

Recommended Answers

All 2 Replies

You can setUndecorated(true); , but that also removes the entire frame and close button, so you would need to add your own border.

The only other way I can think of is to add a component listener like

addComponentListener(new ComponentAdapter() {
    @Override
    public void componentMoved(ComponentEvent e) {
        setLocation(100, 100);
    }

});

But that still allows the frame to be pulled a tiny bit before it snaps back to the location, so it looks a bit odd when you try to drag it.

Hello Ezzaral,

Thank you!

Regards,
sciprog1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.