how can i do this!!!

hello,

i have a bean which gets the users name and password using two methods called getuser()and setuser() what i have got struck is that i should get this values into a class which has a method like this Geninfo("user" , pass") ; actually the values which i get from the bean properties should be updated in variables "user" and "pass" available in a my class !!!

is it simple then please tell how to do it!!

a small sample code may be of immense use to me!!!

[494 byte] By [siv-viv] at [2007-9-26 3:02:18]
# 1

It depends on how you have setup your two different classes. How have you built your 'capture login' bean? What is the construction of the other class that requires the login name and password?

It kind of sounds like you need a third class called 'LoginMediator'. Here is some basic code for you...

public class LoginMediator

{

public static void main(String[] args)

{

LoginBean loginBean = new LoginBean()

loginBean.show(); // allows the user to enter their login information.

//(ALSO assuming this class is a modal dialog box and does not fire events...

OtherClass otherClass = new OtherClass();

otherClass.setLoginData(loginBean.getLoginName(), loginBean.getLoginPass());

...

}

}

That is all you will have to do. Now, if you have events then the design would be slightly different.

Cheers,

nate

Rex_RacerX at 2007-6-29 11:01:10 > top of Java-index,Desktop,Developing for the Desktop...