private void paintButton(Graphics2D graphics, boolean enabled, boolean selected) {
Paint buttonPaint;
Color buttonBorderColorLocal = null;
Color buttonSelectionColorLocal = null;
Ellipse2D buttonBackgroundCircle = new Ellipse2D.Double(1, 1,
BUTTON_DIAMETER - 3, BUTTON_DIAMETER - 3);
if (enabled) {
buttonPaint = new RadialGradientPaint((float)buttonBackgroundCircle.getCenterX(),
(float)buttonBackgroundCircle.getCenterY(),
(float)buttonBackgroundCircle.getWidth() * 2 / 3,
new float[] {0f, 1f}, new Color[] {TerraTheme.darken(buttonColor), buttonColor});
buttonBorderColorLocal = this.buttonBorderColor;
buttonSelectionColorLocal = this.buttonSelectionColor;
}
else {
buttonPaint = disabledButtonColor;
buttonBorderColorLocal = disabledButtonBorderColor;
buttonSelectionColorLocal = disabledButtonSelectionColor;
}
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
// Paint the border
graphics.setColor(buttonBorderColorLocal);
graphics.fillOval(0, 0, BUTTON_DIAMETER - 1, BUTTON_DIAMETER - 1);
// Paint the background
graphics.setPaint(buttonPaint);
graphics.fill(buttonBackgroundCircle);
// Paint the selection
if (selected) {
Ellipse2D buttonSelectionCircle = new Ellipse2D.Double((BUTTON_DIAMETER
- (BUTTON_SELECTION_DIAMETER - 1)) / 2,
(BUTTON_DIAMETER - (BUTTON_SELECTION_DIAMETER - 1)) / 2,
BUTTON_SELECTION_DIAMETER - 1, BUTTON_SELECTION_DIAMETER - 1);
graphics.setColor(buttonSelectionColorLocal);
graphics.fill(buttonSelectionCircle);