Hi,
I have a class Manager and a class ManagerGUI.
My ManagerGUI class looks somehting like this-
public class ManagerGUI extends 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.
public void show()
{
pack();
super.setVisible(true);
}
void addListeners()
{
nameInput.addActionListener(new NameL());
}
class NameL implements ActionListener
{
public void 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();
Is this the correct way of calling the GUI class?
How do I get to use the variable nameE here, in the Manager?
Thanks,
Lucky.