I am trying to change the pitch of a wave file while mouse entering a JButton
.
the problem is the JButton
object doesn't support the SAMPLE_RATE
control.
what can I do to change the pitch?
(FloatControl.Type.SAMPLE_RATE)
I am trying to change the pitch of a wave file while mouse entering a JButton
.
the problem is the JButton
object doesn't support the SAMPLE_RATE
control.
what can I do to change the pitch?
(FloatControl.Type.SAMPLE_RATE)
JButtons of course will never support arbitrary functionality such as that -- they only can do and understand JButton related concepts, and this is as it should be. But all is not lost. You can give your JButton's ButtonModel a ChangeListener and then when the mouse is hovered over the button call the sample rate change on whatever object is controlling the sample rate. Note that in the ChangeListener you'll check the
isRollover()
method to check for hovering.e.g.,
Note, that you may need to do your pitch modification in a background thread off of Swing's event thread.