Here is an example that would use a TextField component for the name entry,
and a label to re-print the name on the screen. This example shows AWT
components. There are similar things for Swing components.
To define the TextField, you would do something like this:
TextField myTextField = new TextField();
To store the value of the text field in another variable, such as a string,
you could do something like this:
String myString = myTextField.toString();
To copy the value from the string variable to a label elsewhere on the form,
you could do something like this:
Label myLabel = Label(myString);
or
Label myLabel = Label();
myLabel.setText(myString);
or
Label myLabel = Label(myTextField.toString());
or
myLabel.setText(myTextField.toString());
There are a variety of ways to do what you are asking. Each component
usually has a method for getting its value, and many of the text based
things have a "setText" method for setting its value to something.
Hope that helps.
----- Original Message -----
From: "Guerrino Di Minno" <GDiMinno@h...>
To: "Professional Java" <pro_java@p...>
Sent: Friday, September 14, 2001 2:41 PM
Subject: [pro_java] Question on storing variables ???
> Hi to all...
>
> I'm using Visual J++...
>
> I have a question. I would like to know,
> when I'm entering a person's name like (Mary Thomas),
> and then pressing enter, how can I store this name in a
> variable and then re-print this name on the screen.
>
> Can anyone, please help me.
>
> Thanking you in advance
>
> Gino
>
> > Guerrino Di Minno
> > Junior Programmer
> > gdiminno@h...
> > (xxx) xxx-xxxx ext. 241
>