开发者

Creating a static method like JOptionPane.showInputDialog() but with my own components in the dialog box

开发者 https://www.devze.com 2023-02-16 15:34 出处:网络
How can write a method that can be used to instantiate an 开发者_StackOverflow中文版object through a dialog, and will not instantiate that object until input has been received?For example, instead of

How can write a method that can be used to instantiate an 开发者_StackOverflow中文版object through a dialog, and will not instantiate that object until input has been received? For example, instead of

int i = JOptionPane.showInputDialog("Enter number: ") how could I have something like char[] c = className.showPasswordDialog("Enter password: ") with a JPasswordField instead of a text field?


JPasswordField pwf = new JPasswordField();
JOptionPane.showInputDialog(pwf);
char[] pswd = pwf.getPassWord();
0

精彩评论

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

关注公众号