Sponsered Links
Categories
Sponsered Links

Swing Message Box

 

This example illustrates how to create message box and input box in swing. In this example you can see that, when user run this program on console then a input box will be appear for entering string value in the input text field. When user enter correctly the text value then the message box with entered text will be display.

Source Code of dialog.java

import java.io.*;
import javax.swing.JOptionPane;

public class dialog{
   
public static void main(String args[])
      
throws IOException{
   
try{
        String input = JOptionPane.showInputDialog
      (
"Welcome! Enter the Message:");
        JOptionPane.showMessageDialog
     (null,
"your Message:"+input);
    } 
catch (Exception e){ 
        JOptionPane.showMessageDialog(
     null,e.getMessage());
       
       }
    }
}

 
 
Sponsered Links
Latest Updates
 
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2009 JSPSERVLETTUTORIAL.INFO All Right Reserved