It specifies the parent component. Here's a typical entry for one of
the method signatures as copied from the Java API:
showInputDialog
public static String showInputDialog(Component parentComponent,
Object message,
String title,
int messageType)
throws HeadlessException
Shows a dialog requesting input from the user parented to
parentComponent with the dialog having the title title and message
type messageType.
Parameters:
parentComponent - the parent Component for the dialog
message - the Object to display
title - the String to display in the dialog title bar
messageType - the type of message that is to be displayed:
ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE,
or PLAIN_MESSAGE
By specifying null it just displays the dialog in the middle of the
screen (well, that's where it's supposed to go). If you specify a
component (such as a JFrame instance) then the dialog will be
displayed over the centre of the component.
There are a few different method signatures though, including some
that don't specify the parent component, for example:
JOptionPane.showInputDialog("Message");
JOptionPane.showInputDialog("Message", "Value");
On 03/02/2010, at 7:11 AM, Mahmoud Abou-Eita wrote:
What's the purpose of the first 'null' argument in JOption's
showInputDialog method?
Thanks.
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en