java小程序之(GUI)输入对话框JOptionpane.showInputDialog
2016-03-24 23:38
357 查看
数据是String类型,可以用Integer.ParseInt()转换成int类型
示例代码:
示例代码:
//用到了javax.swing下的类JOptionPane //显示一个输入对话框(GUI),并从中获取数据。 //将String类型数据的数字转换成数字(int double float等)Integer import java.util.*; //java.long.*;//Integer import javax.swing.*;//JOptionPane public class Demo032201{ public static void main( String [] args ){ String input = JOptionPane.showInputDialog( "enter an input" ); //String input = JOptionPane.showInputDialog( null, "enter an input", "Input Dialog Demo", JOptionPane.QUESTION_MESSAGE ); System.out.println( "input = " + input ); int xxx = Integer.parseInt( input ); System.out.println( input ); } }
相关文章推荐
- LeetCode 128. Longest Consecutive Sequence
- java小程序之(GUI)确认对话框JOptionPane.showConfirmDialog
- Map集合中value()与keySet()、entrySet()区别
- HDU 5493 Queue 树状数组+二分
- iOS 封装UITabBarController(一)
- 20160324 javaweb 之request
- leetcode——232——Implement Queue using Stacks
- iOS UILabel 自适应文字的大小
- Codeforces 301A Yaroslav and Sequence 【思维】
- NBUT [1667] Hkhv Loves Sequences 【最大连续段 模拟】
- hdoj-1005-Number Sequences
- New Technique: Tachyon (used memory instead of disk for HDFS)
- New Technique: Tachyon (used memory instead of disk for HDFS)
- New Technique: Tachyon (used memory instead of disk for HDFS)
- New Technique: Tachyon (used memory instead of disk for HDFS)
- New Technique: Tachyon (used memory instead of disk for HDFS)
- New Technique: Tachyon (used memory instead of disk for HDFS)
- New Technique: Tachyon (used memory instead of disk for HDFS)
- ubuntu12.04与虚拟机VMware (版本:11.0.0 build-2305329)中win7 共享文件夹方法
- boost中的实用工具assign和uuid