JPasswordField Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hayden
    New Member
    • Oct 2007
    • 6

    #1

    JPasswordField Question

    Hi there, I was wondering how, well if I could, use a JPasswordField with JDialog and JOptionPane? I've tried dialog.add(pass wordField) and it compiles, but it looks kinda funky... o_O

    Thanks for any help.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by Hayden
    Hi there, I was wondering how, well if I could, use a JPasswordField with JDialog and JOptionPane? I've tried dialog.add(pass wordField) and it compiles, but it looks kinda funky... o_O

    Thanks for any help.
    Did you try it then?
    P.S Would you by any chance be Matthew Hayden the cricketer?

    Comment

    • Hayden
      New Member
      • Oct 2007
      • 6

      #3
      Yup I tried it and the field was covered up by a blank (white) pane with a input box without the echo characters. Do I need to set the JOptionPane.set WantsInput() to false? Or... :S

      And nope. Just a dude. :P

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by Hayden
        Yup I tried it and the field was covered up by a blank (white) pane with a input box without the echo characters. Do I need to set the JOptionPane.set WantsInput() to false? Or... :S

        And nope. Just a dude. :P
        Use a JDialog or even JFrame and make sure you lay your components nicely using a LayoutManager

        Comment

        • Hayden
          New Member
          • Oct 2007
          • 6

          #5
          Aight, thanks for the help.

          Comment

          • heat84
            New Member
            • Nov 2007
            • 118

            #6
            The showOptionMetho d of JOptionPane can allow you to add components to the dialog. Read more about JOptionPane if you dont need to code the whole dialog from scratch.

            Comment

            Working...