im trying to make a changelistener that controls the volume of a music player, problem is i get a cannot find symbol error on the changelistener, is there an import i am missing or what. any information could help
JSlider vol = new JSlider(JSlider.HORIZONTAL,min, max, init);
vol.setMinorTickSpacing(1);
vol.setMinorTickSpacing(2);
vol.setMinorTickSpacing(3);
vol.setMinorTickSpacing(4);
vol.setMinorTickSpacing(5);
vol.setMinorTickSpacing(6);
vol.setMinorTickSpacing(7);
vol.setMinorTickSpacing(8);
vol.setMinorTickSpacing(9);
vol.setMinorTickSpacing(10);
vol.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent e)
{
JSlider source = (JSlider)e.getSource();
val = source.getValue();
}
});
I had a problem similar to this and I believe if you don't have
import javax.swing.event.*;
it won't work. Try importing that and hopefully it works for you!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.