Stereo Integrity Forums  

Go Back   Stereo Integrity Forums > The Lounge > Graphic, Photography & Coding
Register FAQ Members List Calendar Mark Forums Read

Graphic, Photography & Coding Talk about Graphic Design, Photography and website coding

more Java help

This is a discussion on more Java help within the Graphic, Photography & Coding forums, part of the The Lounge category; OK i need more help now. its the last thing i need to do i think on this. I cant ...

Reply
 
LinkBack Thread Tools Display Modes
Old 04-28-2008, 09:36 PM   #1 (permalink)
Member
 
Megalomaniac's Avatar
 
Join Date: Mar 2008
Posts: 231
Default more Java help

OK i need more help now. its the last thing i need to do i think on this. I cant find in my notes anywhere how to replace a text box with astericks.

like when a person inputs somehting it needs show up as astericks instead of their letters.

oh and i need to check to make sure they match each other when it checks....

Code:
  // create the password label
		labelPass = new JLabel ( );					//instantiate new jlabel
		labelPass.setText ("Password ");					//set label text to Phone #
		labelPass.setLocation(24,290);				//set location of jlabel
		labelPass.setSize(200,25);					//set size of jlabel
		labelPass.setForeground(Color.BLACK);//set initial background color
		contentPane.add(labelPass);					//add jlabel to content pane
		
		// create the password text box
		textPass = new JTextField ( );	//instantiate new JTextField
		textPass.setText("");						//clear jtextfield
		textPass.setToolTipText("Please type in password");
		textPass.setLocation(90,290);		//set location of jtextfield
		textPass.setSize(200,25);				//set size of jtextfield
		contentPane.add(textPass);			//add jextfield to content pane
		
			   // create the repassword label
		labelRepass = new JLabel ( );					//instantiate new jlabel
		labelRepass.setText ("Repassword ");					//set label text to Phone #
		labelRepass.setLocation(24,320);				//set location of jlabel
		labelRepass.setSize(200,25);					//set size of jlabel
		labelRepass.setForeground(Color.BLACK);//set initial background color
		contentPane.add(labelRepass);					//add jlabel to content pane
		
		// create the repassword text box
		textRepass = new JTextField ( );	//instantiate new JTextField
		textRepass.setText("");						//clear jtextfield
		textRepass.setToolTipText("Please type in password again");
		textRepass.setLocation(100,320);		//set location of jtextfield
		textRepass.setSize(200,25);				//set size of jtextfield
		contentPane.add(textRepass);			//add jextfield to content pane


then skipping ahead where the checks are made:

Code:
	private boolean checkPass ()
	{
		
		
		if (textPass.getText().length() == 0)
		{
			labelPass.setForeground(Color.RED);	//password is not correct
			return false;
		}
		else
		{
			labelPass.setForeground(Color.BLACK);	//password is correct
			return true;
		}
	} //end of method
	
	private boolean checkRepass () 
	{
		
		
		if (textRepass.getText().length() == 0  )
		{
			labelRepass.setForeground(Color.RED);	//city is not correct
			return false;
		}
		else
		{
			labelRepass.setForeground(Color.BLACK);	//city is correct
			return true;
		}
	} //end of method

here are my specs in particular this part

Code:
Add labels and textfields for phone, email, password, and retype password.  Make these 
textfields show **** as a user types in their password.  Adjust the GUI any way that you 
like as long as it looks good.
Code:
The checkPassword method needs to be added to program.  This method should 
check the text in the password textfield vs. the text in the retype password textfield.  If 
both of these passwords are equal, then both labels foregrounds (password and retype 
password ) should be set to original color of black.  If these passwords are not equal, 
then both labels foregrounds should be set to red

This the last thing i need help with on this nights HW i am dying here


i know replacing needs to be like

labelPass.replace('insert here', 'here') // problem is that can only do single character replacements with that, unless i misunderstood


also "&" isnt working when setting that boolean condition to make sure they are both equal to each other

Last edited by Megalomaniac; 04-29-2008 at 08:58 AM.
Megalomaniac is offline   Reply With Quote
Old 04-29-2008, 03:13 AM   #2 (permalink)
Junior Member
 
Join Date: Mar 2008
Posts: 42
Default

Are you using && instead of a single &? That's my best guess; I'm "fluent" in assembly but I don't use C / C++ / Java frequently enough to be of much help.
pKelly is offline   Reply With Quote
Old 04-29-2008, 03:15 AM   #3 (permalink)
Junior Member
 
Join Date: Mar 2008
Posts: 42
Default

IE.

if(password_box1 == variable) && (password_box2 == variable)
do whatever();
else
passwords do not match();

I can't remember if you compare those variables with dual or single ==
I think it depends on the type of variables.
pKelly is offline   Reply With Quote
Old 04-29-2008, 08:58 AM   #4 (permalink)
Member
 
Megalomaniac's Avatar
 
Join Date: Mar 2008
Posts: 231
Default

Quote:
Originally Posted by pKelly View Post
Are you using && instead of a single &? That's my best guess; I'm "fluent" in assembly but I don't use C / C++ / Java frequently enough to be of much help.
well "&&" means LOGICIAL AND

and "&" means BOOLEAN AND


when I looked at my notes...
Megalomaniac is offline   Reply With Quote
Reply


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

Posting 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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© Copyright 2003 Stereo Integrity. All rights reserved.