gpt4 book ai didi

带有文本和按钮的 Java 对话框

转载 作者:行者123 更新时间:2023-12-02 07:12:47 24 4
gpt4 key购买 nike

如何创建一个对话框,该对话框的顶部有一个文本,其下方有一个空白区域,用户可以在其中键入内容,在右侧下方有一个 OKAY 按钮,当您单击该按钮时,对话框消失?

像这样:

Input dialog

最佳答案

String input = JOptionPane.showInputDialog(..);

有关更多信息,请参阅 How to Make Dialogs 。这是该文档中的一个示例。

String s = (String)JOptionPane.showInputDialog(
this,
"Complete the sentence:\n"
+ "\"Green eggs and...\"",
"Customized Dialog",
JOptionPane.PLAIN_MESSAGE,
null,
null,
"ham");

JOptionPane requesting input

关于带有文本和按钮的 Java 对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15312769/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com