开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜