我想要做的就是拥有一个带有 JTextArea 而不是 JTextField 的 JOptionPane inputDialog。
我尝试像这样将 JTextArea 放在 Message 参数中
Object[] inputText = new Object[]{new JLabel("Enter Graph Information"),
newJTextArea("",20,10)};
graphInfo=(String)JOptionPane.showInputDialog(null,
inputText,
"Create Graph",
JOptionPane.PLAIN_MESSAGE,
null,
null,
"");
但它的底部仍然有文本字段,我无法从 JTextArea 获取文本。有什么方法可以删除原始文本字段并从 jtextarea 获取文本或将文本字段完全替换为文本区域?如果可能的话,我试图避免制作自定义对话框,而这“似乎”应该很容易做到?