Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8266569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:12:27+00:00 2026-06-08T05:12:27+00:00

How do I display the text of a JPasswordField rather than set 0 as

  • 0

How do I display the text of a JPasswordField rather than set 0 as an echo char?

Java Docs says:

Setting a value of 0 indicates that you wish to see the text as it is typed, similar to the behavior of a standard JTextField.

The following results in an Incompatible types error

outField.setEchoChar(0);

wheras

outField.setEchoChar('0');

simply sets 0 as the echo char (displays 0s for every digit).

The reason for using JPasswordField over JTextField is that I want to change the echo char and hide the password with another method.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:12:29+00:00Added an answer on June 8, 2026 at 5:12 am

    Do this:

    outField.setEchoChar((char)0);
    

    If you do this:

    outField.setEchoChar(0);
    

    then 0 is an integer, not a char, and the method requires a char.

    If you do this:

    outField.setEchoChar('0');
    

    then ‘0’ is equivalent to (char)48.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I conditionally display text on a PHP page of MySQL results that
I have a canvas that I am using a javascript function to display text
I'm trying to display text that is input by the user if it is
I have a need to display text that includes HTML tags etc and TTStyledTextLabel
I am currently using a JEditorPane to display text that is being read from
Im trying to display text but that isnt working. I create a dynamic text
I would like to display text that is stored in my list. I have
I need to programatically set EditText to display text like password and I also
I want to display text that links to a image that opens a new
I have made some small macro that I am using to display text line

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.