So i creating a little java app and am just wondering how i can get the contents of a JTextField and then assign the value into a String variable, I thought below would work:
JTextField txt_cust_Name = new JTextField();
String cust_Name;
txt_cust_Name.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
cust_Name = txt_cust_Name.getText();
}
});
Now i thought that this would send the value of the JtextField into the String Cust_Name.
Anyone have any ideas to do this?
Cheers.