Пример #1
0
 public ArtistList(Locale locale) {
   this.locale = locale;
   this.artists = new ArrayList<Artist>();
   String allSelectedArtistsString = ResourceManager.getLabel("list.artist.all", locale) + " (0)";
   allSelectedArtists = new Artist(allSelectedArtistsString, allSelectedArtistsString, "0", true);
   String compilationString = ResourceManager.getLabel("list.artist.compilation", locale);
   compilation = new Artist(compilationString, compilationString, "1", true);
   this.artists.add(allSelectedArtists);
 }
Пример #2
0
  protected void initialize() {

    this.playIcon =
        new ImageIcon(getClass().getResource("/net/firefly/client/resources/images/play.png"));
    this.pressedPlayIcon =
        new ImageIcon(getClass().getResource("/net/firefly/client/resources/images/play-on.png"));
    this.pauseIcon =
        new ImageIcon(getClass().getResource("/net/firefly/client/resources/images/pause.png"));
    this.pressedPauseIcon =
        new ImageIcon(getClass().getResource("/net/firefly/client/resources/images/pause-on.png"));
    this.stopIcon =
        new ImageIcon(getClass().getResource("/net/firefly/client/resources/images/stop.png"));
    this.pressedStopIcon =
        new ImageIcon(getClass().getResource("/net/firefly/client/resources/images/stop-on.png"));

    setToolTipText(
        ResourceManager.getLabel("player.control.play.pause", context.getConfig().getLocale()));

    setOpaque(false);
    setVerticalAlignment(SwingConstants.CENTER);
    setIcon(this.playIcon);

    setBackground(null);
    setIconTextGap(0);
    setBorder(new EmptyBorder(0, 0, 0, 0));

    addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent e) {
            PlayerStatus playerStatus = context.getPlayer().getPlayerStatus();
            if (playerStatus.equals(PlayerStatus.STATUS_STOPPED)) {
              context.getPlayer().resume();
            } else {
              context.getPlayer().pause();
            }
          }

          public void mousePressed(java.awt.event.MouseEvent e) {
            if (getIcon().toString().equals(playIcon.toString())) {
              setIcon(pressedPlayIcon);
            } else if (getIcon().toString().equals(pauseIcon.toString())) {
              setIcon(pressedPauseIcon);
            } else {
              setIcon(pressedStopIcon);
            }
          }

          public void mouseReleased(MouseEvent arg0) {
            if (getIcon().toString().equals(pressedPlayIcon.toString())) {
              setIcon(playIcon);
            } else if (getIcon().toString().equals(pressedPauseIcon.toString())) {
              setIcon(pauseIcon);
            } else {
              setIcon(stopIcon);
            }
          }
        });

    this.context.getPlayer().addPlayerStatusChangedEventListener(this);
  }
Пример #3
0
 public void addAll(Collection<Artist> artists) {
   this.artists.addAll(artists);
   allSelectedArtists.setArtist(
       ResourceManager.getLabel("list.artist.all", locale)
           + " ("
           + (this.artists.size() - 1)
           + ")");
 }
Пример #4
0
 public void add(Artist artist) {
   this.artists.add(artist);
   allSelectedArtists.setArtist(
       ResourceManager.getLabel("list.artist.all", locale)
           + " ("
           + (this.artists.size() - 1)
           + ")");
 }