java - JOptionPane window opens in background -


i developing swing application, little query joptionpane.showmessagedialog() bugging me:

  • joptionpane.showmessagedialog(null, "record entered successfully");
    if write code message window appears @ of parent frame.
  • joptionpane.showmessagedialog(this, "record entered successfully");
    whereas code automatically places window on parent frame.

the question is: while implementing null first argument message @ background of current parent frame whereas if write this first argument window comes on parent frame. why happenning?

in method

showmessagedialog(component parentcomponent, object message) 

the first argument sets parent of dialog:

parentcomponent

defines component parent of dialog box. used in 2 ways: frame contains used frame parent dialog box, , screen coordinates used in placement of dialog box. in general, dialog box placed below component. parameter may null, in case default frame used parent, , dialog centered on screen (depending on l&f).

i assume method appears inside jframe class, in case passing this argument set parent component frame.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -