Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Java Javatutorial Java Alert Box

Related Tutorials


 
 

Share on Google+Share on Google+

Java Alert Box

Advertisement
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.

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

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 6, 2013

Related Tutorials

Discuss: Java Alert Box  

Post your Comment


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