【问题标题】:Java dialog with text and button带有文本和按钮的 Java 对话框
【发布时间】:2013-03-09 16:03:56
【问题描述】:

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

像这样:

【问题讨论】:

    标签: java swing input dialog


    【解决方案1】:
    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");
    

    【讨论】:

    • 你能给我解释一下吗?
    • 我没想到,链接是 ty
    • 我可以只用ok吗?不行就取消?
    • can I make it with ok only 你看教程了吗???我很难相信您在 11 分钟内阅读了整个教程,然后尝试使用教程中的一些概念进行试验。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-06
    • 2011-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多