java - JDialog appears in the top left corner of screen, when when I've set it's position to the center of its parent -


before initialized dialog

  addquestiondialog = new jdialog(swingutilities.windowforcomponent(this),"add    question); 

and set location of dialog @ center of parent calling:

addquestiondialog.setlocationrelativeto(this) 

this works , displays dialog @ center of parent, when set dialog modal dialog, ignores set method , displays dialog in top left corner of screen.

addquestiondialog = new jdialog(swingutilities.windowforcomponent(this),"add question", dialog.modalitytype.document_modal); 

however when set dialog modal dialog, ignores set method , displays dialog in top left corner of screen.

the order of code should be:

dialog.setlocationrelativeto(..); dialog.setvisible(true ); 

i'm guessing using:

dialog.setvisible(true ); dialog.setlocationrelativeto(..); // not executed until dialog closed. 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -