Todd,
Here's a simple example of what I'm asking.
Assuming I have 3 jtextfields named tf1, tf2 and tf3 and a jlist named jlstChoice which was constructed with the values of "1","2","3". When the user clicks on "1" from the jlstChoice, the text of tf1 will be set to the
string "Chosen Field", if the user clicks on "2", the text of tf2 will be set to the same string and with "3", tf3 will be set to the same string.
Here's the code for the mouseClicked event of jlstChoice.
{
String txtToPrint = new String("Chosen Field");
String chosenValue =
new String(jlstChoice.getSelectedValue().toString());
if (chosenValue.equals("1"))
{tf1.setText(txtToPrint);}
else if (chosenValue.equals("2"))
{tf2.setText(txtToPrint);}
else {tf3.setText(txtToPrint);}
}
What I wanted is just initialize jlstChoice with the values
"tf1", "tf2", "tf3" and whenever the user clicks on any of the choices I am only going to code like this:
{
String txtToPrint = new String("Chosen Field");
String chosenValue =
new String(jlstChoice.getSelectedValue().toString());
//chosenValue now has either "tf1","tf2","tf3"
CHOSENVALUE.setText(txtToPrint); //here's the code I'm asking if possible
//it is something like evaluating its
//value and using it as the component
//name
}