我有一個媒體播放器,我在我的媒體播放器上爲滑塊值和時間值放置了一個listiner我的問題是如何格式化時間我在標籤上顯示爲0:00,第一個0表示秒,第二個表示秒,第三個表示每秒。我如何格式化將要在標籤中的字符串
public void setUpsongDurationSlider()
{
musicMedia.getMediaPlayer().currentTimeProperty().addListener((obs, oldTme, newTime)->
{
homeView.getSongDurationSlider().setValue(newTime.toSeconds());
homeView.getSongDurationSliderLabel().setText(Double.toString((newTime.toMinutes())));
});
}
'0.50分鐘'30秒?這不是你在問題中所要求的! – fabian