filmov
tv
Java GUI Tutorial - Output result on Dialog Box using JOptionPane.showMessageDialog() method

Показать описание
In the previous video, we saw how to use an input dialog box.
In this video, we will now have a look at the output dialog box and the method showMessageDialog()
So, here is the syntax of the showMessageDialog method
As you can notice, the method showMessageDialog takes four 4 parameters
The first parameter is called parentComponent and it represents the parent of the dialog box. If there is no specified parent component then this parameter will be null
The second parameter represents the message to appear in the dialog box
The third parameter is the title of the dialog box
And the fourth parameter represents the MessageType and it can either be an integer value representing the type of icon that will appear in the dialog box or you can use certain JOptionPane options like
For example
JOptionPane.INFORMATION_MESSAGE);
Now if you run, notice the title, the message and the icon denoting the message type. When you click on OK, the dialog box disappears
JOptionPane.PLAIN_MESSAGE);
So, guys that’s how you can output results in your program using dialog box or graphical User Interface
Thanks for viewing, I hope this video was informative and do not forget to subscribe
#codingriver
#java
#programming
Комментарии