Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/372.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将java代码中的菜单转换为对话框_Java_Jakarta Ee - Fatal编程技术网

将java代码中的菜单转换为对话框

将java代码中的菜单转换为对话框,java,jakarta-ee,Java,Jakarta Ee,我需要使用对话框(GUI)创建此菜单,并显示在一个对话框中。我怎样才能做到 System.out.println("--------------------------------------------------Menu Options------------------------------------------------------------------"); System.out.println("\t\t\t\t\tHere you need to e

我需要使用对话框(GUI)创建此菜单,并显示在一个对话框中。我怎样才能做到

System.out.println("--------------------------------------------------Menu Options------------------------------------------------------------------");
            System.out.println("\t\t\t\t\tHere you need to enter a number between 1 and 6 according your choice. ");
            System.out.println("--------------------------------------------------------------------------------------------------------------------------------");
            System.out.println("1.Search for a particular student.");
            System.out.println("2.Show students names, marks and grades.");
            System.out.println("3.Display passes.");
            System.out.println("4.Display failures.");
            System.out.println("5.Show statistics.");
            System.out.println("6.Exit.");
            System.out.println("");
            System.out.println("Enter you choice");
            option=Keyboard.readInt();
            switch (option)
试试这个

 String ques = "<html><body><b>-----------------Menu Options--------------</b><br/>"
            + "Here you need to enter a number between 1 and 6 according your choice.<br/>"
            + "----------------------------------------------------------------------------<br/>"
            + "1.Search for a particular student.<br/>"
            + "2.Show students names, marks and grades.<br/>"
            + "3.Display passes.<br/>"
            + "4.Display failures.<br/>"
            + "5.Show statistics.<br/>"
            + "6.Exit.<br/>"
            + "Enter you choice<br/></body></html>";
     int opt = Integer.parseInt(JOptionPane.showInputDialog(ques));
     System.out.println(opt);
String ques=“--------------菜单选项-----------------
” +“根据您的选择,您需要在此处输入一个介于1和6之间的数字。
” +“--------------------------------------------------------------
” +“1.搜索特定学生。
” +2.显示学生姓名、分数和成绩。
+“3.显示通行证。
” +“4.显示故障。
” +“5.显示统计信息。
” +“6.退出。
” +“输入您的选择
”; int opt=Integer.parseInt(JOptionPane.showInputDialog(ques)); 系统输出打印项次(opt);
请对代码、输入/输出和结构化文档(如HTML或XML)使用代码格式。为此,选择示例并单击消息发布/编辑表单上方的
{}
按钮?thanks@user2999246正如我在上面提到的,有了上述软件包的帮助,我们可以制作更多的GUI,但是要包含大量的文本,比如上面的代码,我需要写些什么,有没有像JOption这样的东西?如果用HTML表示列表,最好使用
/
  • 而不是

    。这可能更适合于传递给的一系列选项。