Esempio n. 1
0
  public void paint(Graphics gg) {
    int faceSize = Math.min(getWidth() - 4, getHeight() - 4);
    if (face == null)
      face =
          new PADFaceMapped(
              Math.max(2, (getWidth() - faceSize) / 2),
              Math.max(2, (getHeight() - faceSize) / 2),
              faceSize);
    if (buffer == null) {
      im = this.createImage(getWidth(), getHeight());
      buffer = im.getGraphics();
    }
    super.paint(buffer);

    buffer.setColor(new Color(255, 255, 255, 0));
    buffer.fillRect(0, 0, im.getWidth(null), im.getHeight(null));

    face.setDimensions(
        Math.max(2, (getWidth() - faceSize) / 2),
        Math.max(2, (getHeight() - faceSize) / 2),
        faceSize);
    face.paint(buffer);

    // draw buffer to screen
    gg.drawImage(im, 0, 0, null, null);
  }
Esempio n. 2
0
  public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2D = (Graphics2D) g;
    int x = this.getWidth();
    int y = this.getHeight();
    int z = 4;

    if (orientation.equals(DesktopBar.WEST)) {
      int[] X = {x - z, x - z, 2 * x / 5, x / 2, z, x / 2, 2 * x / 5};
      int[] Y = {2 * y / 5, 3 * y / 5, 3 * y / 5, y - z, y / 2, z, 2 * y / 5};
      g2D.draw(new Polygon(X, Y, 7));
    }
    if (orientation.equals(DesktopBar.EAST)) {
      int[] X = {z, z, 2 * x / 3, x / 2, x - z, x / 2, 2 * x / 3};
      int[] Y = {2 * y / 5, 3 * y / 5, 3 * y / 5, y - z, y / 2, z, 2 * y / 5};
      g2D.draw(new Polygon(X, Y, 7));
    }
    if (orientation.equals(DesktopBar.NORTH)) {
      int[] X = {2 * x / 5, 3 * x / 5, 3 * x / 5, x - z, x / 2, z, 2 * x / 5};
      int[] Y = {y - z, y - z, 2 * y / 5, y / 2, z, y / 2, 2 * y / 5};
      g2D.draw(new Polygon(X, Y, 7));
    }
    if (orientation.equals(DesktopBar.SOUTH)) {
      int[] X = {2 * x / 5, 3 * x / 5, 3 * x / 5, x - z, x / 2, z, 2 * x / 5};
      int[] Y = {z, z, 2 * y / 3, y / 2, y - z, y / 2, 2 * y / 3};
      g2D.draw(new Polygon(X, Y, 7));
    }
  }
Esempio n. 3
0
  public void paint(Graphics gg) {
    if (osStyle) {
      int faceSize = Math.min(getWidth() - 4, getHeight() - 4);
      if (face == null)
        face =
            new PADFaceMapped(
                Math.max(2, (getWidth() - faceSize) / 2),
                Math.max(2, (getHeight() - faceSize) / 2),
                faceSize);
      if (buffer == null) {
        im = this.createImage(getWidth(), getHeight());
        buffer = im.getGraphics();
      }
      super.paint(buffer);

      buffer.setColor(new Color(255, 255, 255, 0));
      buffer.fillRect(0, 0, im.getWidth(null), im.getHeight(null));

      face.setDimensions(
          Math.max(2, (getWidth() - faceSize) / 2),
          Math.max(2, (getHeight() - faceSize) / 2),
          faceSize);
      face.paint(buffer);

      // draw buffer to screen
      gg.drawImage(im, 0, 0, null, null);

    } else {
      // this is the CUSTOM way of drawing the AffectButton
      int faceSize = Math.min(getWidth() - 4, getHeight() - 4);
      if (face == null)
        face =
            new PADFaceMapped(
                Math.max(2, (getWidth() - faceSize) / 2),
                Math.max(2, (getHeight() - faceSize) / 2),
                faceSize);
      if (buffer == null) {
        im = this.createImage(getWidth(), getHeight());
        buffer = im.getGraphics();
      }

      buffer.setColor(this.getBackground());
      buffer.fillRect(0, 0, getWidth(), getHeight());

      buffer.setColor(Color.gray);
      buffer.drawRect(0, 0, getWidth() - 1, getHeight() - 1);

      if (in) {
        buffer.setColor(new Color(200, 200, 200));
        buffer.drawLine(0, 0, getWidth() - 1, 0);
        buffer.drawLine(0, 0, 0, getHeight() - 1);
        buffer.setColor(Color.darkGray);
        buffer.drawLine(getWidth() - 1, getHeight() - 1, getWidth() - 1, 0);
        buffer.drawLine(getWidth() - 1, getHeight() - 1, 0, getHeight() - 1);
      }
      if (down) {
        buffer.setColor(Color.darkGray);
        buffer.drawLine(0, 0, getWidth() - 1, 0);
        buffer.drawLine(0, 0, 0, getHeight() - 1);
        buffer.setColor(new Color(200, 200, 200));
        buffer.drawLine(getWidth() - 1, getHeight() - 1, getWidth() - 1, 0);
        buffer.drawLine(getWidth() - 1, getHeight() - 1, 0, getHeight() - 1);
      }

      face.setDimensions(
          Math.max(2, (getWidth() - faceSize) / 2),
          Math.max(2, (getHeight() - faceSize) / 2),
          faceSize);
      face.paint(buffer);

      // draw buffer to screen
      gg.drawImage(im, 0, 0, null, null);
    }
  }