4.19今日总结
package TEST;
import javax.swing.JOptionPane; //导入类
public class TEST
{
public static void main(String args[])
{
String input_pane1,input_pane2;
int n1,n2,sum;
input_pane1 = JOptionPane.showInputDialog("Please input the first number"); //输入框1
input_pane2 = JOptionPane.showInputDialog("Please input the second number"); //输入框2
n1 = Integer.parseInt(input_pane1); //获取输入框中输入数据的整数类型
n2 = Integer.parseInt(input_pane2);//获取输入框中输入数据的整数类型
sum = n1+n2;
JOptionPane.showMessageDialog(null, "The sum is: "+sum,"Adding Device",JOptionPane.PLAIN_MESSAGE);
//第1个参数:null 显示在中央
//第2个参数:要显示的字符
//第3个参数:标题栏信息
//第4个参数:对话框类型
System.exit(0); //终结图形用户界面程序必须的
}
————————————————
版权声明:本文为CSDN博主「HeisenbergWDG」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/salmonwilliam/article/details/81952387
浙公网安备 33010602011771号