Some wrapper classes are declared `final` to mimic `final` modifier of JFX
delegate. It is not very useful. Declaring wrapper classes final prevents use
of hierarchical builder pattern. The `final` modifier should be removed from
wrappers.
For instance, wrapper sfxsm.MediaPlayer is final, so we cannot write:
mediaPlayer = new MediaPlayer(media) {
onError = new Runnable {
def run() {
val errorMessage: String = media.getError.getMessage
System.out.println("MediaPlayer Error: " + errorMessage)
}
}
}
Instead this has to be written in a longer form:
mediaPlayer = new MediaPlayer(media)
mediaPlayer.onError = new Runnable {
def run() {
val errorMessage = media.error().getMessage
// Handle errors during playback
println("MediaPlayer Error: " + errorMessage)
}
}
See example of that here:
https://github.com/jsacha/ProScalaFX/blob/c10153a3dfe9507dc3e3eeb993ae74cdd64611
ae/src/proscalafx/ch08/AudioPlayer2/AudioPlayer2.scala#L107
Here are some of the classes:
scalafx.scene.chart.Axis.TickMark
scalafx.scene.chart.CategoryAxis
scalafx.scene.chart.NumberAxis
scalafx.scene.media.AudioClip
scalafx.scene.media.AudioEqualizer
scalafx.scene.media.AudioTrack
scalafx.scene.media.EqualizerBand
scalafx.scene.media.Media
scalafx.scene.media.MediaPlayer
scalafx.scene.media.VideoTrack
Original issue reported on code.google.com by jpsacha on 26 Jul 2013 at 7:24
Original issue reported on code.google.com by
jpsacha
on 26 Jul 2013 at 7:24