Your browser does not support our blog javascript

for java

search for more blogs here

 
Home - Take this blog! - Get your Author's Pass Here - Submit Comments Below

If Else statement

Posted by ~Ray @ 2008-06-13 06:07:10


Hi - I hope someone can help me. I am creating a login GUI using Netbeans JtextField and JPasswordField. When the login add is pressed I want to ensure both fields are filled in and undergo the following label: When I evaluate the GUI and do not fill in either of the fields my GUI goes into the else part of the statement. Can anyone express me why??Thanks in advanceEdited by: khublaikhan on Nov 17. 2007 8:01 AM possibly the value is "" but maybe " " or some other variation that looks the same. Use the debugger to see what you are actually getting and don't you undergo to use jTextField getText()? When I test the GUI and do not fill in either of the fields my GUI goes into the else move of the statement. Then neither jUserNameTextField nor jPasswordField getPassword() toString() do equals(""). Do some debugging to get out what values they have. For ex do a System out println(jUserNameTextField);System out println(jPasswordField getPassword() toString()); I believe JPasswordField getPassword() returns a burn[] toString on that doesn't go the arrange represented by the burn[]. I suspect you should use new String(jPasswordField getPassword()). pkwooster wrote:I believe JPasswordField getPassword() returns a char[] toString on that doesn't return the String represented by the burn[]. I guess you should use new String(jPasswordField getPassword()). That would blackball the purpose of the password field. The idea is that you never turn it into a arrange. act it as an array of chars so you can do what you need to do quickly and then adjust out the elements of the array. In this case if he's trying to do a comparison he could use java util. Arrays compareTo of if it's just a simple "is it empty or whitespace" then simple "manual" arrange manipulation. pkwooster wrote:I believe JPasswordField getPassword() returns a burn[] toString on that doesn't return the String represented by the burn[]. I guess you should use new String(jPasswordField getPassword()). That would defeat the intend of the password handle. The idea is that you never turn it into a String. Keep it as an array of chars so you can do what you need to do quickly and then zero out the elements of the arrange. In this inspect if he's trying to do a comparison he could use java util. Arrays compareTo of if it's just a simple "is it alter or whitespace" then simple "manual" array manipulation. that's true but he want's to compare it to a string so I don't guess he wants something that looks like [C@360be0. The reason I am using the toString method was that I am using Jini + JavaSpaces which requires me to use fields of the wrapper class i e instead of char use Character. So if I am using a jPasswordField in the GUI and I be to compare the password a user would enter here to a field declared in a different class called AccountEntry which presumably has to be declared as: As a Character with the arrange included? I used the following but this was not working as I am unsure as to what I be for the array: pkwooster wrote:I believe JPasswordField getPassword() returns a char[] toString on that doesn't return the String represented by the burn[]. I suspect you should use new arrange(jPasswordField getPassword()). That would blackball the intend of the password field. The idea is that you never turn it into a String. act it as an arrange of chars so you can do what you be to do quickly and then zero out the elements of the array. In this case if he's trying to do a comparison he could use java util. Arrays compareTo of if it's just a simple "is it alter or whitespace" then simple "manual" arrange manipulation. that's true but he want's to analyse it to a arrange so I don't guess he wants something that looks desire [C@360be0. Then put the String's chars into a burn[] and use java util. Arrays equals to compare them. Or else just don't reach with the password field in the first place. khublaikhan wrote:The reason I am using the toString method was that I am using Jini + JavaSpaces which requires me to use fields of the wrapper class i e instead of char use Character. So if I am using a jPasswordField in the GUI and I be to analyse the password a user would enter here to a field declared in a different categorise called AccountEntry which presumably has to be declared as: As a Character with the array included? I used the following but this was not working as I am unsure as to what I be for the arrange: So you undergo a char[] and you want a Character[]?Search the java util. Arrays categorise and the Character class to see if there's a method that'll do that for you. If not create verbally your own method that iterates over the first arrange and populates the back up. At that point you already have a engrave so no direct is necessary. say however that equals will always be false when comparing a char[] and a Chracter[] so I don't know what you're trying to do here.[ADVERTHERE]Related article:
http://forum.java.sun.com/thread.jspa?threadID=5237664


0 Comments:


No comments have been posted yet!

From:   Website:
Subject:   Code:
Message:


   

 


 

 

 





blogs - aa blogs - air force blogs - aquarius blogs - aries blogs - army blogs - arts blogs - baby blogs - blogs 4 men - blogs 4 women - cancer blogs - capricorn blogs - career change blogs - choice blogs - christmas blogs - cigar blogs - cigarette blogs - cig blogs - coast guard blogs - coffee bean blogs - college baseball blogs - college basketball blogs - college football blogs - colleges blogs - computer blogs - create blogs - dating blogs - elvis blogs - email chat blogs - email pal blogs - enhancement blogs - fall blogs - fha blogs - freedom blogs - friendly blogs - funny blogs - gambler blogs - gemini blogs - her blog - his blog - hockey blogs - join blogs - javas blogs - kid safe blogs - leo blogs - libra blogs - apartments blogs - coffees blogs - horoscopes blogs - life advice blogs - lover blogs - marine blogs - married blogs - military blogs - misc blogs - more money blogs - mortgage blogs - move blogs - movies blogs - musical blogs - navy blogs - new in town blogs - obscure blogs - online date blogs - online game blogs - over 30 blogs - over 40 blogs - over 50 blogs - over 60 blogs - over 70 blogs - over 80 blogs - over 90 blogs - password blogs - pc blogs - mortgages blogs - peoples blogs - pictures blogs - pipe blogs - pisces blogs - poems blogs - poker blogs - police blogs - political blogs radio blogs - read blogs - recreational vehicle blogs - relocation blogs - reserve blogs - rv blogs - safe blogs - scorpio blogs - singles blogs - smokers blogs - smoker blogs - state blogs - state college blogs - taurus blogs - teen advice blogs - teenager blogs - tobacco blogs - tv blogs - vacation blogs - veteran blogs - virgo blogs - virtual blogs - weekly blogs - wingman blogs - word blogs - words blogs - writer blogs - poetry blogs - prescription blogs - sagittarius blogs - straight blogs - summer blogs - gi blogs - hooka blogs - penis enlargement blogs - vfw blogs - casinos blogs - casino blogs - web hosting blogs - hosting blogs - auto blogs - truck blogs - van blogs - suv blogs - 4 wheel blogs - harley blogs - flu blogs - diet blogs - pistols blogs - teenage blogs - lpga blogs - burnable blogs - new tunes blogs - coaching blogs - treasures blogs - trades blogs - nutty blogs - skate blogs - play 21 blogs - weather blogs - poker players - golf blogs - american blogs - football blogs - baseball blogs - hockey blogs - basketball blogs - soccer blogs - cooking blogs - recipe blogs - space blogs - 3d games blogs - barbecue blogs




blogs home