Pin It

JOptionPane : Message Dialog in Java Swing

Program to demonstrate working of JOptionPane's Message Dialog in Java Swing

import javax.swing.ImageIcon;
import javax.swing.JOptionPane;

public class MessageDialogDemo {

 public static void main(String[] args) {

  JOptionPane.showMessageDialog(null, "Hello World !!!"); 
  
  JOptionPane.showMessageDialog(null, "Hello World !!!", "Welcome",
    JOptionPane.PLAIN_MESSAGE);
  
  JOptionPane.showMessageDialog(null, "Hello World !!!", "Welcome",
    JOptionPane.INFORMATION_MESSAGE);
  
  JOptionPane.showMessageDialog(null, "Hello World !!!", "Welcome",
    JOptionPane.WARNING_MESSAGE);
  
  JOptionPane.showMessageDialog(null, "Hello World !!!", "Welcome",
    JOptionPane.QUESTION_MESSAGE);
  
  JOptionPane.showMessageDialog(null, "Hello World !!!", "Welcome",
    JOptionPane.ERROR_MESSAGE);
  ImageIcon icon = new ImageIcon("CD.png");
  
  JOptionPane.showMessageDialog(null, "Hello World !!!", "Welcome", 
    JOptionPane.INFORMATION_MESSAGE, icon);  

 }

}



Output of the program :









Watch the Youtube video below for better understanding ... 


 
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Related Posts Plugin for WordPress, Blogger...

Post your related queries below ...

comments powered by Disqus
Powered by Blogger.
 
© 2012 Learn Java by Examples Template by Hubber Spot