I’m creating this application, it has various components (oscillators, effects) to draw a visual waveform. You use controls on the GUI to change the component parameters.
When you interact with one of the controls, I need to update the associated component, and then redraw the output.
public JPanel createOscPanel(Osc o)
{
JPanel cbPanel = new JPanel();
final String[] comboItems = {"Sine", "Custom", "FSaw", "FSquare"};
JComboBox cb = new JComboBox(comboItems);
cbPanel.add(cb);
cb.addActionListener(this);
return cbPanel;
}
public void actionPerformed(ActionEvent e) {
JComboBox cb = (JComboBox)e.getSource();
int value = cb.getSelectedIndex();
System.out.println(value);
}
In this example – how can I pass in that oscillator so I can run a setWaveType() method on it?
Create anonymous handler and change parameter of
createOscPanel.