Zelaron Gaming Forum  
Stats Arcade Portal Forum FAQ Community Calendar Today's Posts Search
Go Back   Zelaron Gaming Forum > The Zelaron Nexus > Science and Art > Tech Help

 
 
Thread Tools Display Modes

 
I've returned with more Java help
Reply
Posted 2010-04-24, 12:59 PM
I'm validating a first name entered into a the java.swing GUI textbox. It must start with Uppercase, follow Lowercase, and no numbers. For some reason one if statement is being ignored for displaying the error messagebox.

Code:
jtext1.addActionListener (
		             new ActionListener() {
		                public void actionPerformed(ActionEvent e) {
		 				   string1=jtext1.getText();
		 				   if(!string1.substring(0,1).matches("[A-Z]")){
		 				        errorReport+=errorUpper;
		 				        errorDetect=true;
		       				}
		       				if(!string1.substring(1,string1.length()).matches("[a-z]*")){
		 						errorReport+=errorLower;
		 						errorDetect=true;
		 					}
		 					for (i=0; i<string1.length(); i++){
		 						if (Character.isDigit(string1.charAt(i))) {
		 							errorReport+=errorAlpha;
		 							errorDetect=true;
		 							break;
		 						}
		 					}
		 					if (errorDetect=true){
		 						JOptionPane.showMessageDialog(null, errorReport);
							}
							errorDetect=false;
							errorReport="Error: ";
		                   jtext2.requestFocus();
		                }
		             }
		          );
Thank you for wasting your time to help me
"Ban shampoo, demand real poo"
Old
Profile PM WWW Search
Slyvr enjoys the static noises of ten television sets simultaneously tuned to 412.84 MHzSlyvr enjoys the static noises of ten television sets simultaneously tuned to 412.84 MHz
 
 
Slyvr
 



 
Reply
Posted 2010-04-24, 01:24 PM in reply to Slyvr's post "I've returned with more Java help"
If(errorDetect==true){

That'll probably sort it.
Old
Profile PM WWW Search
Lenny simplifies with no grasp of the basicsLenny simplifies with no grasp of the basicsLenny simplifies with no grasp of the basicsLenny simplifies with no grasp of the basicsLenny simplifies with no grasp of the basicsLenny simplifies with no grasp of the basics
 
 
Lenny
 



 
Reply
Posted 2010-04-25, 06:43 PM in reply to Lenny's post starting "If(errorDetect==true){ That'll..."
Yeah, I'm retarded. I just realized that a few minutes after posting this haha
"Ban shampoo, demand real poo"
Old
Profile PM WWW Search
Slyvr enjoys the static noises of ten television sets simultaneously tuned to 412.84 MHzSlyvr enjoys the static noises of ten television sets simultaneously tuned to 412.84 MHz
 
 
Slyvr
 
 

Bookmarks

« Previous Thread | Next Thread »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules [Forum Rules]
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Java programming help Plz Slyvr Tech Help 9 2010-03-02 10:56 AM
java help osmoses-jones Tech Help 2 2009-05-11 09:26 AM
IRC Java applet? Chruser Forum News, Suggestions and Discussion 0 2002-04-05 05:03 PM


All times are GMT -6. The time now is 09:22 PM.
'Synthesis 2' vBulletin 3.x styles and 'x79' derivative
by WetWired the Unbound and Chruser
Copyright ©2002-2008 zelaron.com
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.