Results 1 to 2 of 2
  1. #1
    LeonLanford is offline Member
    Join Date
    Oct 2009
    Posts
    29
    Rep Power
    0

    Default How to make Swing JTextField look like AWT TextField?

    Hi, I want to ask more here.. :D

    I just realized that the JTextField and TextField appearance is different. It's same in vista windows theme. I noticed this today when I opened it in XP theme and windows classic theme.

    The Password field is the TextField, it seems sunk down.
    (screenshot at the attachment)

    I tried to set the foreground and background to null but there's no change, also there's no set border attribute for TextField.

    The reason I use TextField not JPasswordField for the password field is because I need to get the password content and send it to the server, server is the one that authenticating it not me.

    I can't use JTextField because it doesn't have setEchoChar method to hide the text.

    Can someone help me to make the TextField looks like JTextField?
    Or does someone know other way to retrieve text from JPasswordField without using deprecated getText method?
    I can only get and pass the password to char[], when I tried to pass to the string, the result is garbled.

    Java Code:
    textpassword.getPassword().toString();
    Java Code:
    [C@82c01f

    Thanks..
    Attached Thumbnails Attached Thumbnails How to make Swing JTextField look like AWT TextField?-bb.jpg  
    Last edited by LeonLanford; 09-04-2010 at 04:04 PM.

  2. #2
    LeonLanford is offline Member
    Join Date
    Oct 2009
    Posts
    29
    Rep Power
    0

    Default

    ah solved it.. I used this

    Java Code:
    String.valueOf(textpassword.getPassword());
    Sorry for making useless topic..

Similar Threads

  1. How to make swing.Timer as a separate class
    By nethz13 in forum New To Java
    Replies: 9
    Last Post: 04-18-2010, 09:14 AM
  2. Replies: 7
    Last Post: 04-10-2010, 11:31 AM
  3. how to make window active and textfield focused
    By whwillisiv in forum New To Java
    Replies: 0
    Last Post: 04-28-2009, 04:06 AM
  4. Replies: 4
    Last Post: 04-08-2009, 05:51 AM
  5. how to make histogram using jfreechart in swing
    By saradap80 in forum Introductions
    Replies: 0
    Last Post: 02-10-2009, 07:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •