Java Alert Box

In this example we will describe java alert box. First of all we have created class than main method after that we have created alert box method. In this method display information message to the user. We use JOptionPane class to display the message alert box. JOptionPane class is available in the javax.swing.*; package.


 
Ads

Java Alert Box

In this example we will describe java alert box. First of all we have created class than main method after that we have created alert box method. In this method display information message to the user. We use JOptionPane class to display the message alert box.  JOptionPane class is available in the javax.swing.*; package.

JOptionPane is a swing application we can use JOptionPane to show message and we can use any java application. JOptionPane has three method but in this example we have used one method.

showMessageDialog():- The showMessageDialog() method which is used to display a simple message.

import javax.swing.JOptionPane;


public class AlertBoxExample {
	
	    public static void main(String[] args) {
		
		String string="Welcome to roseindia.net?";
		
		JOptionPane.showMessageDialog(null,string);

	}
}

Output:

Download Source Code

Advertisements

Share on Google+Share on Google+

Java Alert Box

Posted on: July 6, 2013 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: Java Alert Box  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads