@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); }
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); } }
protected void drawButton(LGraphics g, Button button, int row, int col, int rowNum, int colNum) { if (button.isVisible) { int cellWidth = (scaledWidth - 2 * PADDING_X) / colNum; int cellHeight = (scaledHeight - 2 * PADDING_Y) / rowNum; int absoluteX = x + PADDING_X + col * cellWidth; int absoluteY = y + PADDING_Y + row * cellHeight + (cellHeight - button.getHeight()) / 2; if (getCurWidth(row) > 0) absoluteX = getCurWidth(row) + 5; button.setDrawXY(absoluteX, absoluteY); button.draw(g); setCurWidth(row, absoluteX + button.getWidth()); } }
private void updateHeight() { if (getHeight() == 0) { setHeight(DEFAULT_SIZE); return; } if (orientation == HORIZONTAL) { incButton.setHeight(Math.min(getHeight(), incButton.getHeight())); decButton.setHeight(Math.min(getHeight(), decButton.getHeight())); slider.setHeight(Math.min(getHeight(), slider.getHeight())); slider.setY(getHeight() / 2f - slider.getHeight() / 2f); incButton.setY(getHeight() / 2f - incButton.getHeight() / 2f); decButton.setY(getHeight() / 2f - incButton.getHeight() / 2f); } else { // VERTICAL decButton.setY(getHeight() - decButton.getHeight()); slider.setY(incButton.getHeight()); slider.setHeight(getHeight() - (incButton.getHeight() + decButton.getHeight())); } }