开发者

How do I set the text in it at the beginning when the dialog opens?

I have the following code that displays a JDialog, it shows a text field, I assume it's a 开发者_StackOverflow中文版JTextField.

How do I set the text in it at the beginning when the dialog opens?

JOptionPane pane = new JOptionPane("", JOptionPane.QUESTION_MESSAGE);
pane.setWantsInput(true);
JDialog dialog = pane.createDialog(null, "Test");
dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
dialog.setVisible(true);


Use:

pane.setInitialSelectionValue("foo");

to set the input value that is initially displayed as selected to the user.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜