我创建了一个打开 JOptionPane
的按钮。它允许用户输入 string..>> String str = JOptionPane.showInputDialog
如何获取用户输入到 joptionpane 中的文本并使用它来搜索用户对象?
非常感谢
最佳答案
返回的字符串是用户输入的内容,如果用户选择取消则返回 null:
String whatTheUserEntered = JOptionPane.showInputDialog(...);
if (whatTheUserEntered == null) {
System.out.println("The user canceled");
}
关于java - JOptionPane 并从输入中获取文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8346650/