final AudioClip ping = new AudioClip( "http://soundbible.com/grab.php?id=1815&type=wav" ); webView.getEngine().locationProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldLocation, String newLocation) { if (newLocation != null && newLocation.startsWith("http://www.google.com") { ping.play(); } } });
AudioClip plonkSound = new AudioClip("http://somehost/path/plonk.aiff"); plonkSound.play();
AudioClip plonkSound = new AudioClip("http://somehost/path/plonk.aiff"); plonkSound.play();
AudioClip plonkSound = new AudioClip("http://somehost/path/plonk.mp3"); plonkSound.play();
AudioClip plonkSound = new AudioClip("http://somehost/path/plonk.aiff"); plonkSound.play();
AudioClip soundMyNoise = new AudioClip(new File("noises/roll.wav").toURI().toString()); soundMyNoise.play();
class JustAGUIExample { private Label scoresLabel; private MyGameLogic gameLogic; private AudioClip levelUpAudio = new AudioClip("levelup.mp3"); public JustAGUIExample() { scoresLabel.textProperty().bind( gameLogic.scoreProperty().asString() ); gameLogic.scoreProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { levelUpAudio.play(); } }); } }
final AudioClip audioClip = new AudioClip(AUDIO_FILE_LOC); final ImageView graphic = new ImageView(new Image(BUTTON_ICON_LOC));
ping = new AudioClip("http://soundbible.com/grab.php?id=1815&type=wav");