Exemple #1
0
  public void paintComponent(Graphics g) {
    // We request keyboard focus out here so that we can catch events for locking zoom, etc.
    requestFocus();

    // 3 Images are painted each time. The reason we use images rather than directly drawing
    // onto the graphics context is that the drawings of one image can be taking place
    // concurrently with the other using threads into offscreen graphic contexts assoc.
    // with the respective images. While printing we do the opposite

    if (setupComplete && currImg != null) {
      int prevH = getPrev(currImg.imgIdH);
      int nextH = getNext(currImg.imgIdH);

      if (blFlag || !timer.isRunning()) {
        img[prevH].paintStuff1(0, g, this);
        currImg.paintStuff1(_xPix, g, this);
        img[nextH].paintStuff1(_xPix + _xPix, g, this);

        /*g.drawImage (img [prevH].img, 0, 0, this);
        g.drawImage (img [prevH].timeimg, 0, _yPix, this);

        g.drawImage (currImg.img, _xPix, 0, this);
        g.drawImage (currImg.timeimg, _xPix, _yPix, this);

        g.drawImage (img [nextH].img, _xPix + _xPix, 0, this);
        g.drawImage (img [nextH].timeimg, _xPix + _xPix, _yPix, this);*/
      } else {
        img[prevH].paintStuff2(0, g, this);
        currImg.paintStuff2(_xPix, g, this);
        img[nextH].paintStuff2(_xPix + _xPix, g, this);

        /*g.drawImage (img [prevH].img1, 0, 0, this);
        g.drawImage (img [prevH].timeimg, 0, _yPix, this);

        g.drawImage (currImg.img1, _xPix, 0, this);
        g.drawImage (currImg.timeimg, _xPix, _yPix, this);

        g.drawImage (img [nextH].img1, _xPix + _xPix, 0, this);
        g.drawImage (img [nextH].timeimg, _xPix + _xPix, _yPix, this);*/
      }
    }

    if (zoomLkLineDispStatus && zXTime >= begTime && zXTime <= endTime) {
      int xcord = panePosX + getEvtXCord(zXTime - begTime);
      g.setColor(Color.white);
      g.drawLine(xcord, 0, xcord, _yPix);
      g.fillRect(xcord, _yPix - lineSize, zLockStrW + 2, lineSize);
      g.setColor(Color.black);
      g.drawRect(xcord, _yPix - lineSize, zLockStrW + 1, lineSize - 1);
      g.setColor(Color.red);
      g.drawString("Zoom Lock", xcord + 1, _yPix - fDescent);
    }

    if (elTLineDispStatus && elapsedPoint >= begTime && elapsedPoint <= endTime) {
      int xcord = panePosX + getEvtXCord(elapsedPoint - begTime);
      g.setColor(Color.white);
      g.drawLine(xcord, 0, xcord, _yPix);
      g.fillRect(xcord, _yPix - lineSize, elTimeStrW + 2, lineSize);
      g.setColor(Color.black);
      g.drawRect(xcord, _yPix - lineSize, elTimeStrW + 1, lineSize - 1);
      g.setColor(Color.red);
      g.drawString("Elapsed Time", xcord + 1, _yPix - fDescent);
    }
  }