Ejemplo n.º 1
0
  private void drawColorButton(Graphics g, int no) {
    g.setColor(cDarkShadowColor);
    g.drawLine(mRect[no].x, mRect[no].y, mRect[no].x + mRect[no].width - 2, mRect[no].y);
    g.drawLine(mRect[no].x, mRect[no].y, mRect[no].x, mRect[no].y + mRect[no].height - 2);
    g.drawLine(
        mRect[no].x + mRect[no].width - 2,
        mRect[no].y + 2,
        mRect[no].x + mRect[no].width - 2,
        mRect[no].y + mRect[no].height - 2);
    g.drawLine(
        mRect[no].x + 2,
        mRect[no].y + mRect[no].height - 2,
        mRect[no].x + mRect[no].width - 2,
        mRect[no].y + mRect[no].height - 2);

    if (mPressedButton != no || !mMouseOverButton) g.setColor(Color.white);

    g.drawLine(
        mRect[no].x + 1, mRect[no].y + 1, mRect[no].x + mRect[no].width - 3, mRect[no].y + 1);
    g.drawLine(
        mRect[no].x + 1, mRect[no].y + 1, mRect[no].x + 1, mRect[no].y + mRect[no].height - 3);

    if (mPressedButton == no && mMouseOverButton) g.setColor(Color.white);

    g.drawLine(
        mRect[no].x + mRect[no].width - 1,
        mRect[no].y + 1,
        mRect[no].x + mRect[no].width - 1,
        mRect[no].y + mRect[no].height - 1);
    g.drawLine(
        mRect[no].x + 1,
        mRect[no].y + mRect[no].height - 1,
        mRect[no].x + mRect[no].width - 1,
        mRect[no].y + mRect[no].height - 1);

    if (mColorListMode != VisualizationColor.cColorListModeCategories && no == cColorWedgeButton) {
      int x1 = mRect[no].x + 2;
      int x2 = x1 + mRect[no].width - 4;
      if (x1 < x2) {
        for (int x = x1; x < x2; x++) {
          int c = mWedgeColorList.length * (x - x1) / (x2 - x1);
          g.setColor(
              (mPressedButton == no && mMouseOverButton)
                  ? mWedgeColorList[c].darker()
                  : mWedgeColorList[c]);
          g.drawLine(x, mRect[no].y + 2, x, mRect[no].y + mRect[no].height - 3);
        }
      }
    } else {
      Color color =
          (mColorListMode == VisualizationColor.cColorListModeCategories)
              ? mCategoryColorList[no]
              : mWedgeColorList[no * (mWedgeColorList.length - 1)];
      if (mPressedButton == no && mMouseOverButton) color = color.darker();

      g.setColor(color);
      g.fillRect(mRect[no].x + 2, mRect[no].y + 2, mRect[no].width - 4, mRect[no].height - 4);
    }
  }