java小程序之(GUI)确认对话框JOptionPane.showConfirmDialog
来源:互联网 发布:跟淘宝一样的购物软件 编辑:程序博客网 时间:2024/05/17 09:29
猜生日,示例程序:
//import javax.swing.JOptionPane;import javax.swing.*;public class Demo032401{ public static void main( String [] args ){ String s1 = " 1 3 5 7\n " + " 9 11 13 15 \n " + " 17 19 21 23\n " + " 25 27 29 31\n "; String s2 = " 2 3 6 7\n " + " 10 11 14 15\n " + " 18 19 22 23\n " + " 26 27 30 31\n "; String s3 = "4 5 6 7\n " + " 12 13 14 15\n " + " 20 21 22 23\n " + " 28 29 30 31\n "; String s4 = " 8 9 10 11\n " + " 12 13 14 15\n " + " 24 25 26 27\n " + " 28 29 30 31\n "; String s5 = " 16 17 18 19\n " + " 20 21 22 23\n " + " 24 25 26 27\n " + " 28 29 30 31\n "; int day = 0; int answer = JOptionPane.showConfirmDialog( null, " Is your birthday in these numbers?\n " + s1 ); if ( answer == JOptionPane.YES_OPTION ) day += 1; answer = JOptionPane.showConfirmDialog( null, " Is your birthday in these numbers?\n " + s2 ); if ( answer == JOptionPane.YES_OPTION ) day += 2; answer = JOptionPane.showConfirmDialog( null, " Is your birthday in these numbers?\n " + s3 ); if ( answer == JOptionPane.YES_OPTION ) day += 4; answer = JOptionPane.showConfirmDialog( null, " Is your birthday in these numbers?\n " + s4 ); if ( answer == JOptionPane.YES_OPTION ) day += 8; answer = JOptionPane.showConfirmDialog( null, " Is your birthday in these numbers?\n " + s5 ); if ( answer == JOptionPane.YES_OPTION ) day += 16; //show your birthday number JOptionPane.showMessageDialog( null, " Your birthday number is " + day + " ! " ); System.out.println( "RUN OVER!!!" ); }}
0 0
- java小程序之(GUI)确认对话框JOptionPane.showConfirmDialog
- Java确认对话框(JOptionPane.showConfirmDialog())的使用说明
- java小程序之(GUI)输入对话框JOptionpane.showInputDialog
- java小程序之(GUI)确认对话框控制循环
- 关于JOptionPane.showConfirmDialog()确认框的操作
- 如何为JOPtionPane的showConfirmDialog对话框中的按钮设置监听
- JOptionPane.showConfirmDialog例…
- Java GUI textfield+JOptionPane
- Java GUI 使用确认对话框控制循环
- JOptionPane.showInputDialog & JOptionPane.showConfirmDialog & showMessageDialog的应用
- 关于JOptionPane的showConfirmDialog问题
- Java中的Dialog、JOptionPane对话框
- javax.swing.JOptionPane 类的 showConfirmDialog 方法
- 对话框的学习showConfirmDialog
- 使用showConfirmDialog显示确认框
- Java小程序之GUI开发简单前台登录界面
- 对话框 JOptionPane
- JOptionPane 对话框
- 数据存储
- 如何从零开始学习Ruby
- ProgressDialog的详细使用总结
- 三维图像技术与OpenGL基础理论
- 变量、数据类型和运算符
- java小程序之(GUI)确认对话框JOptionPane.showConfirmDialog
- LeetCode 128. Longest Consecutive Sequence
- Dijkstra找最短路径
- 深入理解RunLoop
- Uva160——Factors and Factorials
- gym 100935B (字典树)
- Spring Bean的域scop
- HTML中img路径问题
- 虚幻4目录结构