예제 #1
0
  @Override
  public void renderWindowCloseButton(Graphics gfx, Button w) {
    int x = w.getAbsoluteX();
    int y = w.getAbsoluteY();

    gfx.setColor(borderColor);
    gfx.setLineWidth(2);
    gfx.drawRect(x, y, w.getWidth(), w.getHeight());

    if (w.isMouseOver()) gfx.setColor(Color.white);
    else gfx.setColor(Color.black);

    gfx.drawLine(x, y, x + w.getWidth(), y + w.getHeight());
    gfx.drawLine(x, y + w.getHeight(), x + w.getWidth(), y);
  }
예제 #2
0
  public void renderButton(Graphics gfx, Button b, String text, Image icon) {
    int x = b.getAbsoluteX();
    int y = b.getAbsoluteY();

    if (b.isPressed()) gfx.setColor(backColor1);
    else gfx.setColor(backColor2);
    gfx.fillRect(x, y, b.getWidth(), b.getHeight());

    if (b.isMouseOver()) gfx.setColor(Color.white);
    else gfx.setColor(borderColor);
    gfx.setLineWidth(2);
    gfx.drawRect(x, y, b.getWidth(), b.getHeight());

    if (icon != null) gfx.drawImage(icon, x, y);

    if (text != null) {
      if (b.isEnabled()) gfx.setColor(Color.white);
      else gfx.setColor(Color.black);
      gfx.drawString(text, x + 4, y + 2);
    }
  }