1

我想要一个带有文本框和按钮的 joptionpane,当单击按钮时执行我自己的功能

4

2 回答 2

5
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.life.java.so.questions;

import javax.swing.JOptionPane;

/**
 *
 * @author Jigar
 */
public class InputDialog {
    public static void main(String[] args) {
        String input = JOptionPane.showInputDialog("Enter Input:");
        System.out.println(input);
    }
}

输出 :

替代文字

于 2011-01-05T09:03:30.707 回答
0

也许您只想要一个带有 JLabel 或 JTextArea 和 JButton 的模态 JDialog。

于 2011-01-05T08:49:52.583 回答