Home Java Javatutorial Java Alert Box
Questions:Ask|Latest


 
 

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

Advertisement

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

Ask Questions?    Discuss: Java Alert Box  

Post your Comment


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