how to stop the Dialog from being dragged

I was hoping that someone could tell me when calling a Dialog from Jframe, a how to stop the Dialog from being dragged

while a dialog is showing.

When it is visible I can still click and drag the Dialog

I want to set it so you can not drag it until the dialog has be closed.

[301 byte] By [sathiqa] at [2007-10-2 11:38:22]
# 1
just pass the reference of ur parent frame.Regards,Ciya
ciyaa at 2007-7-13 5:22:55 > top of Java-index,Desktop,Core GUI APIs...
# 2
Canu give me a sample Code please?
sathiqa at 2007-7-13 5:22:55 > top of Java-index,Desktop,Core GUI APIs...
# 3
Read the JDialog API. You specify the parent JFrame in the constuctor and make the dialog modal.
camickra at 2007-7-13 5:22:55 > top of Java-index,Desktop,Core GUI APIs...
# 4

If you don't have access to the parent frame, a "hack" that usually works:

Frame frame = Frame.getFrames()[0];

if (null != frame && frame instanceof JFrame){

JFrame jf = (JFrame)frame;

JDialog jd = new JDialog(jf, "title");

... code here ...

}

As each JFrame (or Frame) is opened, its stored in the array of Frames that you can get. Same thing with Dialog.getDialogs(). Almost always, at least so far for me I've never had this problem, the [0] index is the main window opened, or the parent/top frame. I'd put the check in there to be safe and make sure its a JFrame and usually you'll only have the one JFrame.

buckman1a at 2007-7-13 5:22:55 > top of Java-index,Desktop,Core GUI APIs...