我有 3 个不同的按钮,每个按钮都有一个 actionListener。他们都工作,但我无法在他们执行任务时获得一个按钮来打断其他人?我希望在按下按钮时删除任务,因此新任务将立即开始。
button.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent event1)
{
int data1[] = {1100,1000,900,800,700,600,500,400,300,200,100};
String labels2[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"};
barGraph.changeDataWithEffect(data1, labels2);
}
});
button2.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent event2)
{
int data2[] = {1,2,3,4,5,6,7,8,9,10,11};
String labels2[] ={"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"};
barGraph.changeDataWithEffect(data2, labels2);
}
});
button3.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent event3)
{
int data3[] = {10,20,30,40,50,60,50,40,30,20,10};
String labels3[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"};
barGraph.changeDataWithEffect(data3, labels3);
}
});