Results 1 to 3 of 3
  1. #1
    markious's Avatar
    markious is offline Member
    Join Date
    Oct 2008
    Posts
    27
    Rep Power
    0

    Default JOptionPane.showMessageDialog(null,"Etc Etc"); - What does null actually do?

    Been using JOptionPane.showMessageDialog(null,"Etc Etc"); for a while now, but it was never explained to me what "null" does

    I had a read through the API definition but thats making it more confusing.


    Found here:

    JOptionPane (Java 2 Platform SE v1.4.2)

    Can anyone break it down so that its easier to understand.

    Thanks Guys

    Mark

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,762
    Blog Entries
    7
    Rep Power
    21

    Default

    That first parameter is the JFrame on top of which (read: in front of which) the JOptionPane should be shown; if you don't supply one (the parameter value is null) the JOptionPane creates an invisible JFrame on top of which it is displayed.

    kind regards,

    Jos

  3. #3
    markious's Avatar
    markious is offline Member
    Join Date
    Oct 2008
    Posts
    27
    Rep Power
    0

Similar Threads

  1. How to "allow null" in a very simple script?
    By Mattedatten in forum New To Java
    Replies: 7
    Last Post: 12-05-2010, 12:09 AM
  2. Replies: 0
    Last Post: 07-28-2009, 07:45 PM
  3. Replies: 1
    Last Post: 10-20-2008, 08:35 AM
  4. Why does it still have it as "Null"?
    By cart1443 in forum New To Java
    Replies: 1
    Last Post: 02-07-2008, 06:56 AM
  5. Name Coming Up As "null"
    By sylo18 in forum New To Java
    Replies: 8
    Last Post: 10-30-2007, 11:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •