K
Katie Moore
Hi,
I was using a JTextField originally but I can not get the information from
the text field. What I would like to happen is get the information from a
textfield once a "Send" button is pressed. This is my action handler and
listener. However it always sets Topuc to null. Any suggestions?
JTextField topicField=new JTextField();
topicField.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
JTextField tfTopic = (JTextField)e.getSource();
Topic = (String)tfTopic.getText();
}
});
topicField.setText("");
I was using a JTextField originally but I can not get the information from
the text field. What I would like to happen is get the information from a
textfield once a "Send" button is pressed. This is my action handler and
listener. However it always sets Topuc to null. Any suggestions?
JTextField topicField=new JTextField();
topicField.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
JTextField tfTopic = (JTextField)e.getSource();
Topic = (String)tfTopic.getText();
}
});
topicField.setText("");