نمایش نتایج 1 تا 2 از 2

نام تاپیک: How to put JPasswordField on JOptionPane.showInputDialog ?

  1. #1

    How to put JPasswordField on JOptionPane.showInputDialog ?

    salam,

    man mikham tooye "JOptionPane.showInputDialog", yek "JPasswordField" bezaram.
    khode showInputDialog ye JTextField generate mikone. vali man be ye JPasswordField ehtiaj daram.

    chejoori mitoonam inkaro konam?

    mamnoon

    in code mane:


    // JPasswordField pf = new JPasswordField();
    // String str = new String (pf.getPassword());

    String pass = JOptionPane.showInputDialog(null,
    "Enter password to access:",
    "Demanding Password",
    JOptionPane.QUESTION_MESSAGE);

  2. #2

    JPasswordField pwd = new JPasswordField();
    Object[] message = { "This is some message \n", pwd };
    int resp = JOptionPane.showConfirmDialog(null, message,
    "Retrieve Password", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
    if(resp == JOptionPane.OK_OPTION) {
    String pass = new String(pwd.getPassword());
    }


    Don't use showInputDialog, though, or it'll still put the plain text field

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •