开发者

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

开发者 https://www.devze.com 2023-02-12 18:18 出处:网络
I have the following code that displays a JDialog, it shows a text field, I assume it\'s a 开发者_StackOverflow中文版JTextField.

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

精彩评论

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

关注公众号