Forums Register Login

modifiers

+Pie Number of slices to send: Send
"can you please explain me this one



hear why we are useing nul"
+Pie Number of slices to send: Send
If you look in the Java API documentation, you'll see that the parentComponent field is documented as follows: -

parentComponent - determines the Frame in which the dialog is displayed; if null, or if the parentComponent has no Frame, a default Frame is used
message - the Object to display



That basically tells you what you need to know. You're asking it to use a default Frame as the parent of your message dialog.

If your application is a console application, this could be appropriate. If it's an application with a Swing or AWT user interface, it is probably wrong; you should be passing a parent component - perhaps the outermost Frame of your application.

Note that using the default Frame in this, or any other, Swing method call has an unpleasant side effect. Because this Frame is out of your control, it sticks around after the rest of your application has closed down. It can keep the Swing event processing thread going and prevent your application from shutting down cleanly. You will find yourself having to use System.exit(), which is an ugly and bad way to exit a Java application. You can avoid this by always passing a component of your own as the parent of any component you create. You can create an invisible Frame of your own as the parent of anything that has no other obvious parent. When it is time to exit the application, make sure you dispose() this Frame.

By the way UseAMeaningfulSubjectLine
[ July 11, 2007: Message edited by: Peter Chase ]
Can you really tell me that we aren't dealing with suspicious baked goods? And then there is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 499 times.
Similar Threads
Netscape7.1 and window.createPopup()
Why we live?
input type=file
onload
build.xml question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 09:13:10.