Ejemplo n.º 1
0
  // Paint the round background and label.
  protected void paintComponent(Graphics g) {
    if (getModel().isArmed()) {
      // You might want to make the highlight color
      // a property of the RoundButton class.
      g.setColor(Color.lightGray);
    } else {
      g.setColor(getBackground());
    }
    g.fillOval(0, 0, getSize().width - 1, getSize().height - 1);

    // This call will paint the label and the
    // focus rectangle.
    super.paintComponent(g);
  }
Ejemplo n.º 2
0
  public void paintComponent(Graphics g) {
    if (m.isPressed()) {
      t = colorCount - 1;
      g.setColor(pressed[t]);
      g.fillRect(0, 0, getSize().width - 1, getSize().height - 1);
      g.setColor(border[t]);

    } else {
      g.setColor(rollOver[t]);
      g.fillRect(0, 0, getSize().width - 1, getSize().height - 1);
      g.setColor(border[t]);
      if (m.isRollover()) {
        if (t < colorCount - 1 && !fadeIn.isRunning()) {
          fadeOut.stop();
          fadeIn.start();
        }
      } else {
        if (t > 0 && !fadeOut.isRunning()) {
          fadeIn.stop();
          fadeOut.start();
        }
      }
    }

    super.paintComponent(g);
  }
Ejemplo n.º 3
0
 @Override
 protected void paintComponent(Graphics g) {
   // TODO Move this code to a UI if necessary, for now KIFSS
   g.setColor(getBackground());
   g.fillRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 2, 2);
   g.setColor(new Color(0xe4e8ea));
   g.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 2, 2);
   super.paintComponent(g);
 }
 public void paintComponent(Graphics g) {
   super.paintComponent(g); // should have look and feel of a
   // button...
   int playerNum = currState.getPlayerNum(row, col);
   if (playerNum != 0) {
     drawDisk(g, playerNum); // draw disk on top!
   }
   for (int pNum = 1; pNum <= 2; pNum++)
     if (currState.isWinPositionFor(row, col, pNum)) drawWinSituation(g, pNum);
 }
Ejemplo n.º 5
0
 /**
  * Draws the 'x' on the button.
  *
  * @param g The graphics component of this button.
  */
 protected void paintComponent(Graphics g) {
   super.paintComponent(g);
   Graphics2D g2 = (Graphics2D) g.create();
   if (this.getModel().isPressed()) g2.translate(1, 1);
   g2.setStroke(new BasicStroke(2));
   g2.setColor(Color.BLACK);
   g2.drawLine(7, 5, 11, 9);
   g2.drawLine(11, 5, 7, 9);
   g2.dispose();
 }
    protected void paintComponent(Graphics g) {
      super.paintComponent(g);

      Dimension size = getSize();
      Graphics2D g2 = (Graphics2D) g;
      if (hasFocus() && isEnabled()) {
        g2.setStroke(TABBUTTON_FOCUS_STROKE);
        g2.setColor(TABBUTTON_FOCUS_COLOR);
        g2.drawRect(2, 2, size.width - 5, size.height - 5);
      }
    }
Ejemplo n.º 7
0
  /**
   * Overrides the <code>paintComponent</code> method of <tt>JButton</tt> to paint the button
   * background and icon, and all additional effects of this configurable button.
   *
   * @param g The Graphics object.
   */
  @Override
  protected void paintComponent(Graphics g) {
    Graphics2D g1 = (Graphics2D) g.create();
    try {
      internalPaintComponent(g1);
    } finally {
      g1.dispose();
    }

    super.paintComponent(g);
  }
 @Override
 protected void paintComponent(Graphics g) {
   if (getModel().isArmed()) {
     g.setColor(Color.lightGray);
   } else {
     g.setColor(getBackground());
   }
   Graphics2D graphics2d = (Graphics2D) g;
   graphics2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   graphics2d.fill(makeStarDesign(5, new Point(50, 50), 50, 30));
   super.paintComponent(g);
 }
Ejemplo n.º 9
0
 protected void paintComponent(Graphics maing) {
   ButtonModel buttonModel = getModel();
   Graphics2D g = (Graphics2D) maing.create();
   g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   if (buttonModel.isRollover()) {
     if (buttonModel.isPressed()) {
       g.drawImage(img3, 0, 0, getWidth(), getHeight(), null);
     } else g.drawImage(img2, 0, 0, getWidth(), getHeight(), null);
   } else g.drawImage(img1, 0, 0, getWidth(), getHeight(), null);
   if (Settings.drawTracers) {
     g.setColor(Color.CYAN);
     g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
   }
   g.dispose();
   super.paintComponent(maing);
 }
 // paint the cross
 @Override
 protected void paintComponent(Graphics g) {
   super.paintComponent(g);
   Graphics2D g2 = (Graphics2D) g.create();
   // shift the image for pressed buttons
   if (getModel().isPressed()) {
     g2.translate(1, 1);
   }
   g2.setStroke(stroke);
   g2.setColor(Color.BLACK);
   if (getModel().isRollover()) {
     g2.setColor(Color.RED);
   }
   g2.drawLine(DELTA, DELTA, getWidth() - DELTA - 1, getHeight() - DELTA - 1);
   g2.drawLine(getWidth() - DELTA - 1, DELTA, DELTA, getHeight() - DELTA - 1);
   g2.dispose();
 }
Ejemplo n.º 11
0
 // paint the cross
 protected final void paintComponent(final Graphics graphic) {
   super.paintComponent(graphic);
   final Graphics2D g2D = (Graphics2D) graphic.create();
   // shift the image for pressed buttons
   if (getModel().isPressed()) {
     g2D.translate(1, 1);
   }
   g2D.setStroke(new BasicStroke(2));
   g2D.setColor(Color.BLACK);
   if (getModel().isRollover()) {
     g2D.setColor(Color.MAGENTA);
   }
   final int delta = NUMBER_6;
   g2D.drawLine(delta, delta, getWidth() - delta - 1, getHeight() - delta - 1);
   g2D.drawLine(getWidth() - delta - 1, delta, delta, getHeight() - delta - 1);
   g2D.dispose();
 }
Ejemplo n.º 12
0
 // paint the cross
 protected void paintComponent(Graphics g) {
   super.paintComponent(g);
   Graphics2D g2 = (Graphics2D) g.create();
   // shift the image for pressed buttons
   if (getModel().isPressed()) {
     g2.translate(1, 1);
   }
   g2.setStroke(new BasicStroke(2));
   g2.setColor(Color.BLACK);
   if (getModel().isRollover()) {
     g2.setColor(Color.RED);
   }
   int delta = 6;
   g2.drawLine(delta, delta, getWidth() - delta - 1, getHeight() - delta - 1);
   g2.drawLine(getWidth() - delta - 1, delta, delta, getHeight() - delta - 1);
   g2.dispose();
 }
Ejemplo n.º 13
0
  protected void paintComponent(Graphics g) {
    // setCircular(isCircular());
    // NeptusLog.pub().info("<###>paint");
    Graphics2D g2 = (Graphics2D) g;
    g2.setColor(getBackground());

    // g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
    //        RenderingHints.VALUE_ANTIALIAS_ON);
    // g2.setRenderingHint(RenderingHints.KEY_RENDERING,
    //        RenderingHints.VALUE_RENDER_QUALITY);

    Rectangle ret = g2.getClipBounds();
    if (isDoubleCircle())
      ret = new Rectangle(getWidth() / 6, getHeight() / 6, getWidth() * 2 / 3, getHeight() * 2 / 3);
    else ret = new Rectangle(0, 0, getWidth(), getHeight());

    pressed = getModel().isPressed();
    Arc2D.Double arc =
        new Arc2D.Double(ret.x, ret.y, ret.width - 1, ret.height - 1, 0, 360, Arc2D.CHORD);
    if (pressed) g2.setColor(getBackground().darker());
    g2.fill(arc);

    super.paintComponent(g);

    if (isContentAreaFilled()) {
      Color backColor = null;
      if (getParent() != null) backColor = getParent().getBackground();
      else backColor = new JButton().getBackground();

      AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OUT);
      BufferedImage buffImg =
          new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);
      Graphics2D gbi = buffImg.createGraphics();
      gbi.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      gbi.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
      gbi.setComposite(ac);
      gbi.setColor(backColor);
      gbi.fillRect(0, 0, getSize().width, getSize().height);
      Color fc = getBackground().darker();
      if (!getModel().isEnabled()) fc = Color.GRAY;
      gbi.setColor(fc);
      gbi.fillOval(0, 0, getSize().width, getSize().height);
      g2.drawImage(buffImg, 0, 0, getWidth(), getHeight(), this);
    }
  }
Ejemplo n.º 14
0
  // Paint the round background and label.
  protected void paintComponent(Graphics g) {
    int w = getWidth();
    int h = getHeight();

    Graphics2D g2d = (Graphics2D) g;
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    // RenderingHints renderHints = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
    // RenderingHints.VALUE_ANTIALIAS_ON);
    // renderHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    // renderHints.put(RenderingHints.KEY_TEXT_ANTIALIASING,
    // RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

    // // g2d.setRenderingHints(renderHints);
    // g2d.setColor(color);
    // g2d.fillRoundRect(0, 0, w, h, 11, 11);

    super.paintComponent(g);
  }
  @Override
  public void paintComponent(Graphics g) {

    shape = getPath();
    border = getPath();
    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setComposite(makeComposite(0.8f));
    color = getBackground();
    g2.setColor(color);
    if (color == Variables.inactive) g2.setComposite(makeComposite(0.5f));
    g2.fill(getPath());
    g2.setColor(color);
    g2.setStroke(new BasicStroke(1));
    g2.setComposite(makeComposite(1.0f));
    g2.draw(border);
    g2.setStroke(new BasicStroke());
    super.paintComponent(g2);
  }
Ejemplo n.º 16
0
 @Override
 protected void paintComponent(Graphics g) {
   super.paintComponent(g);
   Graphics2D g2 = (Graphics2D) g.create();
   if (getModel().isPressed()) {
     g2.translate(1, 1);
   }
   try {
     g2.drawImage(
         ImageIO.read(TabbedPane.class.getResourceAsStream("icons/close.png")),
         3,
         3,
         g2.getClipBounds().width - 3,
         g2.getClipBounds().height - 3,
         0,
         0,
         24,
         24,
         new ImageObserver() {
           @Override
           public boolean imageUpdate(
               Image img, int infoflags, int x, int y, int width, int height) {
             return false;
           }
         });
   } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   /*g2.setStroke(new BasicStroke(2));
    *  g2.setColor(Color.BLACK);
    *  if (getModel().isRollover()) {
    *  g2.setColor(Color.WHITE);
    *  }
    *  int delta = 6;
    *  g2.drawLine(delta, delta, getWidth() - delta - 1, getHeight()
    *   - delta - 1);
    *  g2.drawLine(getWidth() - delta - 1, delta, delta, getHeight()
    *   - delta - 1);*/
   g2.dispose();
 }
Ejemplo n.º 17
0
 @Override
 protected void paintComponent(Graphics g) {
   ButtonModel buttonModel = getModel();
   Graphics2D gd = (Graphics2D) g.create();
   gd.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   gd.setPaint(
       new GradientPaint(0, 0, Color.decode("#6dc550"), 0, getHeight(), Color.decode("#5fb544")));
   if (buttonModel.isRollover()) {
     gd.setPaint(
         new GradientPaint(
             0, 0, Color.decode("#5fb544"), 0, getHeight(), Color.decode("#6dc550")));
     if (buttonModel.isPressed())
       gd.setPaint(
           new GradientPaint(
               0, 0, Color.decode("#1e7d00"), 0, getHeight(), Color.decode("#91e53c")));
     else setForeground(Color.white);
   }
   gd.fillRect(0, 0, getWidth(), getHeight());
   gd.dispose();
   super.paintComponent(g);
 }
Ejemplo n.º 18
0
  @Override
  protected void paintComponent(Graphics g) {
    Graphics2D grafis = (Graphics2D) g.create();
    gradien = new GradientPaint(0, 0, Color.WHITE, getWidth(), getHeight(), Color.BLACK);
    Shape rorec = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), 50, 50);
    if (isFokus()) {
      glass =
          new GradientPaint(
              0, 0, new Color(1F, 1F, 1F, 0F), 0, getHeight(), new Color(1F, 1F, 1F, 0.5F));
    } else {
      glass =
          new GradientPaint(
              0, 0, new Color(1F, 1F, 1F, 0.5F), 0, getHeight(), new Color(1F, 1F, 1F, 0F));
    }

    grafis.setPaint(gradien);
    grafis.fill(rorec);
    super.paintComponent(g);
    grafis.setPaint(glass);
    grafis.fill(rorec);
    grafis.dispose();
  }
Ejemplo n.º 19
0
  protected void paintComponent(Graphics maing) {
    ButtonModel buttonModel = getModel();
    Graphics2D g = (Graphics2D) maing.create();
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    int w = getWidth();
    int h = getHeight();

    if (!isEnabled()) {
      g.drawImage(genButton(w, h, lockedTX), 0, 0, w, h, null);
    } else if (buttonModel.isRollover()) {
      if (buttonModel.isPressed()) {
        new MusPlay("click.mp3");
        g.drawImage(genButton(w, h, pressedTX), 0, 0, w, h, null);
      } else g.drawImage(genButton(w, h, rolloverTX), 0, 0, w, h, null);
    } else g.drawImage(genButton(w, h, defaultTX), 0, 0, w, h, null);

    if (Settings.drawTracers) {
      g.setColor(Color.RED);
      g.drawRect(0, 0, w - 1, h - 1);
    }
    g.dispose();
    super.paintComponent(maing);
  }
    private void doPaint(Graphics g) {
      GraphicsUtil.setupAntialiasing(g);

      final boolean isEmpty = getIcon() == null && StringUtil.isEmpty(getText());
      final Dimension size = getSize();
      if (isSmallVariant()) {
        final Graphics2D g2 = (Graphics2D) g;
        g2.setColor(UIUtil.getControlColor());
        final int w = getWidth();
        final int h = getHeight();
        if (getModel().isArmed() && getModel().isPressed()) {
          g2.setPaint(
              new GradientPaint(
                  0,
                  0,
                  UIUtil.getControlColor(),
                  0,
                  h,
                  ColorUtil.shift(UIUtil.getControlColor(), 0.8)));
        } else {
          g2.setPaint(
              new GradientPaint(
                  0,
                  0,
                  ColorUtil.shift(UIUtil.getControlColor(), 1.1),
                  0,
                  h,
                  ColorUtil.shift(UIUtil.getControlColor(), 0.9)));
        }
        g2.fillRect(2, 0, w - 2, h);
        GraphicsUtil.setupAntialiasing(g2);
        if (!myMouseInside) {
          g2.setPaint(
              new GradientPaint(
                  0, 0, UIUtil.getBorderColor(), 0, h, UIUtil.getBorderColor().darker()));
          // g2.setColor(UIUtil.getBorderColor());
        } else {
          g2.setPaint(
              new GradientPaint(
                  0,
                  0,
                  UIUtil.getBorderColor().darker(),
                  0,
                  h,
                  UIUtil.getBorderColor().darker().darker()));
        }
        g2.drawRect(2, 0, w - 3, h - 1);
        final Icon icon = getIcon();
        int x = 7;
        if (icon != null) {
          icon.paintIcon(null, g, x, (size.height - icon.getIconHeight()) / 2);
          x += icon.getIconWidth() + 3;
        }
        if (!StringUtil.isEmpty(getText())) {
          final Font font = getFont();
          g2.setFont(font);
          g2.setColor(UIManager.getColor("Panel.foreground"));
          g2.drawString(getText(), x, (size.height + font.getSize()) / 2 - 1);
        }
      } else {
        super.paintComponent(g);
      }
      final Insets insets = super.getInsets();
      final Icon icon = isEnabled() ? ARROW_ICON : DISABLED_ARROW_ICON;
      final int x;
      if (isEmpty) {
        x = (size.width - icon.getIconWidth()) / 2;
      } else {
        if (isSmallVariant()) {
          x = size.width - icon.getIconWidth() - insets.right + 1;
        } else {
          x =
              size.width
                  - icon.getIconWidth()
                  - insets.right
                  + (UIUtil.isUnderNimbusLookAndFeel() ? -3 : 2);
        }
      }
      if (UIUtil.isUnderDarcula()) {
        g.setXORMode(new Color(208, 188, 159));
      }
      icon.paintIcon(null, g, x, (size.height - icon.getIconHeight()) / 2);
      g.setPaintMode();
    }
Ejemplo n.º 21
0
 @Override
 public void paintComponent(Graphics g) {
   Graphics2D g2d = (Graphics2D) g;
   g2d.setRenderingHints(StartupManager.HINTS);
   super.paintComponent(g2d);
 }
 @Override
 protected void paintComponent(Graphics g) {
   super.paintComponent(g);
   if (image != null) g.drawImage(image, 0, 0, this);
 }
Ejemplo n.º 23
0
 public void paintComponent(Graphics g) {
   setAntiAliasEnabled(g);
   super.paintComponent(g);
 }
Ejemplo n.º 24
0
 /** paintComponent from JComponents class that draw the card image */
 @Override
 protected void paintComponent(Graphics g) {
   super.paintComponent(g);
   g.drawImage(image, 0, 0, this.getWidth(), this.getHeight(), null);
 }
 /** Paints with G. */
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
 }
Ejemplo n.º 26
0
  protected void paintComponent(Graphics g) {
    super.paintComponent(g);

    int width = this.getWidth();
    int height = this.getHeight();
    if (!isDisabled) {
      if (this.state == FLAG) {
        g.fillRect(width / 3, height / 5, 2, 3 * height / 5);
        g.setColor(Color.RED);
        g.fillPolygon(
            new int[] {width / 3 + 2, 2 * width / 3, width / 3 + 2},
            new int[] {height / 5, 3 * height / 5, 3 * height / 5},
            3);
      }
    } else {
      switch (state) {
        case MINE: // draw mine in the button
          this.disableButton();
          if (thisMineClicked) g.setColor(Color.RED);
          else g.setColor(Color.BLACK);
          g.fillOval(width / 2 - 5, height / 2 - 5, 10, 10);
          g.fillRect(width / 2 - 1, height / 5, 3, 3 * height / 5);
          g.fillRect(width / 5, height / 2 - 1, 3 * width / 5, 3);
          break;
        case NUMBER:
          switch (num) {
            case 1:
              g.setColor(Color.GREEN);
              g.drawString("1", width / 3, 2 * height / 3);
              break;
            case 2:
              g.setColor(Color.BLUE);
              g.drawString("2", width / 3, 2 * height / 3);
              break;
            case 3:
              g.setColor(Color.RED);
              g.drawString("3", width / 3, 2 * height / 3);
              break;
            case 4:
              g.setColor(Color.DARK_GRAY);
              g.drawString("4", width / 3, 2 * height / 3);
              break;
            case 5:
              g.setColor(Color.MAGENTA);
              g.drawString("5", width / 3, 2 * height / 3);
              break;
            case 6:
              g.setColor(Color.ORANGE);
              g.drawString("6", width / 3, 2 * height / 3);
              break;
            case 7:
              g.setColor(Color.PINK);
              g.drawString("7", width / 3, 2 * height / 3);
              break;
            case 8:
              g.setColor(Color.YELLOW);
              g.drawString("8", width / 3, 2 * height / 3);
              break;
            default:
              break;
          }
        default:
          break;
      }
    }
  }