Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Using a password field

  1. #1
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Cool Using a password field

    I tried to use one, but I can't figure out how to set one up.

    Do you add it to a separate JFrame?

    I'm gonna try this(though where do I put it in the Window Listener? I'm thinking windowOpened()).

    public JPasswordFrame extends JFrame()
    {
    private JPasswordField field;
    private JLabel label;
    private JButton ok;
    public JPasswordFrame()
    {
    setTitle("Enter password");
    label = new JLabel("Enter password here.");
    field = new JPasswordField();
    ok = new JButton("Ok");
     
    }
     
    public String getPasswordText()
    {
    return field.getText();
    }
     
    }

    Now what?

    I'd like it to work inside a JFrame and have JPasswordFrame come up and not go away or let the user into the JFrame until they get it right.


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: Using a password field

    Can you show us all your code? Something we can compile..
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

Similar Threads

  1. password field, with focused "Enter" button
    By chronoz13 in forum Java Swing Tutorials
    Replies: 1
    Last Post: June 13th, 2010, 06:00 PM
  2. [SOLVED] how to get each field of a current date
    By chronoz13 in forum Java Theory & Questions
    Replies: 4
    Last Post: January 24th, 2010, 06:33 AM
  3. [SOLVED] find the position of the field separator in the String---need help ASAP
    By rajesh.mv in forum Java Theory & Questions
    Replies: 6
    Last Post: August 17th, 2009, 11:33 AM
  4. password
    By 5723 in forum Algorithms & Recursion
    Replies: 9
    Last Post: July 9th, 2009, 06:26 AM
  5. Java password generator program to generate 8 random integers
    By Lizard in forum What's Wrong With My Code?
    Replies: 3
    Last Post: May 16th, 2009, 08:49 AM