blaze12364
March 27th, 2008, 06:53 AM
Hi i want to be able to automatically activate a JButton and run the commands under that button when new button 'All Targets' is selected.
I have the following code, can anyone help?
JButton all_tar = new JButton ("All Targets");
all_tar.addActionListener(this);
JButton calcuate = new JButton ("Calculate");
calculate.addActionListener(this);
if (arg == "All Targets")
{
for (m = 100; m < 1000; m++)
{
tgetbox.setText(" " + (int)(m));
target = m;
//here is where i want to automatically activate another button
}
}
if (arg == "Calculate") //this is the button that i want to automatically activate numerous times
{ //instructions
}
I have the following code, can anyone help?
JButton all_tar = new JButton ("All Targets");
all_tar.addActionListener(this);
JButton calcuate = new JButton ("Calculate");
calculate.addActionListener(this);
if (arg == "All Targets")
{
for (m = 100; m < 1000; m++)
{
tgetbox.setText(" " + (int)(m));
target = m;
//here is where i want to automatically activate another button
}
}
if (arg == "Calculate") //this is the button that i want to automatically activate numerous times
{ //instructions
}