【发布时间】:2011-01-05 08:47:33
【问题描述】:
我想要一个带有文本框和按钮的 joptionpane,当点击按钮时执行我自己的功能
【问题讨论】:
-
什么是“文本框”。我不知道 Swing 中有任何具有该名称的组件。
标签: java swing joptionpane
我想要一个带有文本框和按钮的 joptionpane,当点击按钮时执行我自己的功能
【问题讨论】:
标签: java swing joptionpane
/*
* 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);
}
}
输出:
【讨论】:
也许您只想要一个带有 JLabel 或 JTextArea 和 JButton 的模态 JDialog。
【讨论】: