Sometimes we may need in java programming to use input box to take input from the users in the same way we may also need to show some result or data in the pop up message dialog box.
Here I have given a little example of how to show or use Message Dialog Box and Message Input Box in java.
Here in the example Message Input Box will take input from the user and show the result in Message Dialog box.
Here is the code example:
import javax.swing.*;
class jPaneTest
{
public void jOptionPaneTest()
{
String reason=JOptionPane.showInputDialog(“Please Enter Number:”);
JOptionPane.showMessageDialog(null,”Your Marks:”+reason);
}
public static void main(String args[])
{
jPaneTest newTest=new jPaneTest();
newTest.jOptionPaneTest();
}
}