use of the form input

Hi,

I have a class Manager and a class ManagerGUI. I have formatted the code so that it is more readable.

My ManagerGUI class looks somehting like this-

publicclass ManagerGUIextends JFrame

{

String name;

JPanel namePanel;

JTextField nameInput;

JLabel nameLabel;

Manager empAgent;

ManagerGUI(Manager ea)

{

super(ea.getLocalName());

empAgent = ea;

//make the name panel and add it to the topPanel.

addListeners();

getContentPane().add(topPanel, BorderLayout.CENTER);

setResizable(false);

}//end constructor.

publicvoid show()

{

pack();

super.setVisible(true);

}

void addListeners()

{

nameInput.addActionListener(new NameL());

}

class NameLimplements ActionListener

{

publicvoid actionPerformed(ActionEvent e)

{

nameE = nameInput.getText();

}

}

}//end class ManagerGUI.

I have tried to seperate it out so that any changes can be easily implemented (although it perhaps is a long way of doing things).

Now I have a class Manager that wants to call the GUI and then process the information got from the text field.

I use the following lines to call the GUI class.

manGui =new ManagerGUI(this);

manGui.show();

I want to use the variablenameE in the Manager. How can I do that?

Thanks.

[2385 byte] By [arudolea] at [2007-10-2 6:08:26]
# 1
Duplicate post. See http://forum.java.sun.com/thread.jspa?threadID=686105&messageID=3993035#3993035You could put a get method in the nameL class that returns nameE. Then call it from your managerGUI
legoqueena at 2007-7-16 13:09:00 > top of Java-index,Java Essentials,Java Programming...