Hide/Show Password in a JTextFIeld (Java Swing)

后端 未结 3 1678
日久生厌
日久生厌 2021-02-05 10:35

So I\'ve been working on a Password Strength Checker and the way it works is that the user enters some random text into a textfield and then instantaneous visual feedback (break

3条回答
  •  逝去的感伤
    2021-02-05 10:37

    ok thanks for tutorialnya,

    and ex,

    action chechbox / double click

    private void lihatActionPerformed(java.awt.event.ActionEvent evt) {  
    
       if (lihat.isSelected()) {
          password.setEchoChar((char)0); //password = JPasswordField
       } else {
          password.setEchoChar('*');
       }
    }
    

提交回复
热议问题