Say i have an object of the JFrame class as frame
I was wondering what is the difference between
JOptionPane.showMessageDialog(null,message)
and
JOptionPane.showMessageDialog(frame,message)
to print something out.Both give the same result and they pop up at the same place.So i was wondering what is really the difference between these two? What happens actually in background differently?
When providing the frame or any other component the option pane will pop up at the middle of the component. However if you are providing null then it will pop up at the middle of your screen.
In your case I guess your Jframe is of your screen size. So if you reduce your frame size and start it at the default location i.e top left corner then you may see the difference.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加