/** 实现歌词的滚动显示 */
  public void scroll() {
    Date startTime = new Date();
    for (int i = 0; i < lrcAnalyst.getLrcTimeValAndIndex().size(); i++) {
      while (true) {
        try {
          Thread.currentThread().sleep(50);

          Date currentTime = new Date();
          LrcTimeAndIndexNum fl = (LrcTimeAndIndexNum) (lrcAnalyst.getLrcTimeValAndIndex().get(i));
          float diffTime = currentTime.getTime() - startTime.getTime();
          lrcIndex = fl.getLrcIndex() - lrcAnalyst.getRealLrcStartOffset();
          if (fl.getLrcTime() - (float) diffTime / 1000 < 0.0) {
            scrollPoint.y--;
            // System.out.println((String) lrcAnalyst.getLrcContent().get(
            //        fl.getLrcIndex()- lrcAnalyst.getRealLrcStartOffset()));
            repaint();

            break;
          }
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }
  }
  public void paintComponent(Graphics brush) {
    // 用背景色覆盖,原来的文字就看不到了。再写上新的文字,由于视觉停留,
    // 看起来文字就会滚动
    brush.setColor(getBackground());
    brush.fillRect(0, 0, getSize().width, getSize().height);

    brush.setColor(Color.blue);
    brush.setFont(fontOfChar);

    // i为下标,用来历遍歌词缓存容器,
    // 当scrollPoint.y+(heightOfChar*i)<0 时,会把文字写到面板上方,看不见。
    // 没有必要显示。
    // scrollPoint.y+(heightOfChar*i)=0 => i=(-scrollPoint.y/heightOfChar)
    // 故要使(-scrollPoint.y/heightOfChar)和 0 作比较,要是小于0,i取0
    /*int i = 0;
    if ((-scrollPoint.y / heightOfChar) > 0)
    {
        i = (-scrollPoint.y / heightOfChar);
    }*/

    /*String lyrics = null;
    for (; i < lrcAnalyst.getLrcContent().size(); i++)
    {
        // 当条件成立,文字会写到面板下方,也没有必要显示,跳出循环
        if (scrollPoint.y + (heightOfChar * i) > getSize().height)
        {
            break;
        }
        lyrics = (String) (lrcAnalyst.getLrcContent().get(i));
        // 见scroll(),靠scrollPoint.y的上移,使文字上移
        brush.drawString(lyrics, scrollPoint.x, scrollPoint.y
                 + (heightOfChar * i));
    }        */

    String lyrics = (String) lrcAnalyst.getLrcContent().get(lrcIndex);
    // 见scroll(),靠scrollPoint.y的上移,使文字上移
    brush.drawString(lyrics, scrollPoint.x, -scrollPoint.y + 20);
  }
 public LrcScrollPane() {
   lrcAnalyst = new LrcAnalystBase();
   lrcAnalyst.readFile("六月的雨.lrc");
   lrcAnalyst.parseLyrics();
   scrollPoint = new Point(5, getSize().height);
 }