Ritz
07-03-2003, 02:59 AM
I have a written a program, but I'm stuck with the folowig problem. My program schematically looks like this:
______________________________________________________
class One
{
int i;
One()
{
Two second=new Two();
i=second.bleep(i);
}
}
class Two
{
JButton pushButton=new JButton("Push");
int bleep(int k)
{
pushButton.addActionListener(new pushListener());
}
public class pushListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
???????????????????
}
}
}
____________________________________________________
I want 'bleep' to return the value k+2 if the button is pushed.
However, I can not use 'return' where the question marks are.
Using return in 'bleep' would not require the button.
How to solve this?
Maurice
______________________________________________________
class One
{
int i;
One()
{
Two second=new Two();
i=second.bleep(i);
}
}
class Two
{
JButton pushButton=new JButton("Push");
int bleep(int k)
{
pushButton.addActionListener(new pushListener());
}
public class pushListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
???????????????????
}
}
}
____________________________________________________
I want 'bleep' to return the value k+2 if the button is pushed.
However, I can not use 'return' where the question marks are.
Using return in 'bleep' would not require the button.
How to solve this?
Maurice