这是我目前正在尝试的:
final AudioClip note0 = new AudioClip(getClass().getResource("/Downloads/notes/A3.aiff").toString());
key0.setOnMouseClicked(new EventHandler<MouseEvent>()
{
@Override
public void handle(MouseEvent me)
{
note0.play();
}
});
我想将一个键(矩形对象)绑定到一个音符(.aiff 音频文件)。但是,我不确定如何在 .getResource() 中引用文件路径。谁能给我建议如何进行?谢谢!