java - JPasswordField not working properly -



java - JPasswordField not working properly -

i don't know what's wrong code password not turn dots. please help me. >.<

here ui code:

private final jpanel contentpanel = new jpanel(); public jpasswordfield password_id; public jformattedtextfield user_id; public jbutton btnaccept; private jformattedtextfield previouslyfocusedtextbox = user_id; public login(final jframe parent, boolean modal) { super(parent, modal); setbounds(100, 100, 469, 428); getcontentpane().setlayout(new borderlayout()); final toolkit toolkit = toolkit.getdefaulttoolkit(); final dimension screensize = toolkit.getscreensize(); final int x = (screensize.width - getwidth()) / 2; final int y = (screensize.height - getheight()) / 2; setlocation(x, y); setresizable(false); flowlayout flow_2 = new flowlayout(0,0,0); final jpanel panel_1 = new jpanel(); panel_1.setbackground(new color(128, 0, 128)); panel_1.setpreferredsize(new dimension(10, 90)); panel_1.setbounds(new rectangle(0, 0, 100, 100)); panel_1.setborder(new emptyborder(50, 90, 0, 0)); panel_1.setlayout(flow_2); header_login.add(panel_1, borderlayout.south); user_id = new jformattedtextfield(); user_id.setfocustraversalkeysenabled(true); user_id.setfocusable(true); user_id.addfocuslistener(this); user_id.setbounds(0, 0, 423, 45); panel_1.add(user_id); user_id.setminimumsize(new dimension(8, 32)); user_id.setui(new jtextfieldhintui("enter id here", color.gray)); user_id.sethorizontalalignment(swingconstants.left); user_id.setfont(new font("calibri", font.bold, 35)); user_id.setpreferredsize( new dimension(10, 40) ); user_id.setcolumns(20); flowlayout flow_3 = new flowlayout(0,0,0); jpanel body_login = new jpanel(); body_login.setbackground(new color(128, 0, 128)); body_login.setborder(new emptyborder(0, 0, 0, 0)); getcontentpane().add(body_login, borderlayout.center); body_login.setlayout(flow_3); password_id = new jpasswordfield (); password_id.setfocustraversalkeysenabled(true); password_id.setfocusable(true); password_id.addfocuslistener(this); body_login.add(password_id); password_id.setminimumsize(new dimension(8, 32)); password_id.setui(new jtextfieldhintui("enter password here", color.gray)); password_id.sethorizontalalignment(swingconstants.left); password_id.setfont(new font("calibri", font.bold, 35)); password_id.setpreferredsize( new dimension(100, 40) ); password_id.setcolumns(20);

and @ end of code got this:

public void focusgained(focusevent ev) { //system.out.println("change"); if(ev.getsource() instanceof jformattedtextfield) { previouslyfocusedtextbox = (jformattedtextfield) ev.getsource(); } } public void focuslost(focusevent arg0) { // todo auto-generated method stub }

i know bit messy , i'm still new in programming ui manually that's why don't know way around. anyway, jpasswordfield not turn text dots. made work while ago revert 1 time again thinking wasn't working. anyway, can't create work 1 time again , don't know create work. original code password is:

public jformattedtextfield password_id; password_id = new jformattedtextfield((format) null);

when changed code jpasswordfield field not focus on password field maybe because of formattedtextfield in previouslyfocusedtextbox. don't know should create jpasswordfield create work. project not made me that's why don't understand of uses. please help me out.

use jpaswordfield instead of jtextformated field

java swing jpasswordfield

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -