java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
fr.paris.saclay.sidescroller.controllers.components.musicPlayer.MusicBar
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class MusicBar extends JPanel
Song bar displaying the current progress of the song.
See Also:
  • Constructor Details

    • MusicBar

      public MusicBar(int width, int height, MusicPlayer player)
      Creates a MusicBar instance, starting the audio playback.
      Parameters:
      width - width of the component.
      height - height of the component.
      player - music player.
  • Method Details

    • play

      public void play()
      Starts audio playback when level starts.
    • paintComponent

      protected void paintComponent(Graphics graphics)
      Draws the MusicBar, displaying current progress with a little vertical rectangle.
      Overrides:
      paintComponent in class JComponent
      Parameters:
      graphics - the rendering environment.
    • getDeltaSong

      public int getDeltaSong()
      Get current song timestamp.
      Returns:
      current song progress.
    • getMediaPlayer

      public Clip getMediaPlayer()
      Gets media player.
      Returns:
      the media player