Created
June 14, 2011 11:52
-
-
Save jintujacob/1024755 to your computer and use it in GitHub Desktop.
A java code to implement basic gui for input and output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.JOptionPane; | |
public class UsingSwingClass { | |
/** | |
* Implementinng the input dialog box and show message | |
*+box | |
* Something to check on the showMessage dialog box | |
* JOption.PLAIN_MESSAGE is the one without any icon | |
*/ | |
public static void main(String[] args) { | |
String num1, num2; | |
int number1, number2, sum; | |
num1 = JOptionPane.showInputDialog("num1"); | |
number1 = Integer.parseInt(num1); | |
num2 = JOptionPane.showInputDialog("num2"); | |
number2 = Integer.parseInt(num2); | |
sum = number1 + number2; | |
JOptionPane.showMessageDialog(null, "the sum is : " + sum , "Results", JOptionPane.PLAIN_MESSAGE ); | |
System.exit(0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!