Hi all, I'm a first year comp engineering major and am having some issues with a program I am writing. Hope someone can help....
I am writing a GUI program and need to catch the user action when a certain button is clicked. I have set up all the ActionListeners and ActionEvents however I am not sure how to write the "doButtonClicked" methods for them. I need help in creating such a method for both a JButton and a JComboBox.
Here is my code, can anyone please help. Thanks in advance.
Code for JButton (need help writing -
private void doIterateButtonClicked(int numIterations) method) :
JButton iterateOne = new JButton("Iterate Once"); //Iterate once button
iterateOne.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
doIterateButtonClicked(1);
}
});
Code for JComboBox
(need help writing - doThresholdChanged(JComboBox comboBox) method):
JComboBox choices = new JComboBox(THRESHOLDS); //Thresholds selection box
choices.setSelectedIndex(0);
choices.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
doThresholdChanged((JComboBox)e.getSource());
}
});