About JtextField and JButton problem
hi, I dont know how to make this, hope to get help:)
I wanna like this:
A JtextField object -- for user to input some Integer
A JButton -- when users click the button, the content in JtextFiled will be delivered to a variable (say, int a, sent to this "a")in my program.
Here, We dont need to check the content if it is Integer or not for simple.
Any idea for me? thanks!
[410 byte] By [
xixiaoa] at [2007-11-26 13:46:29]

Write a listener class that implements listener interface. in that class implement the actionPerformed method of the super interface as u need.( I.e assign the value to the variable). Then bind this class with ur button using addActionListener() method( look in API).
ex:
bottonName.addActionListener( new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
var = textarea.val;
}
});