Here you can find the source of getDarker(Color color, double factor)
public static Color getDarker(Color color, double factor)
//package com.java2s; /*//from w ww.j av a 2 s. co m * UIUtils.java 2/6/13 1:04 PM * * Copyright (C) 2012-2013 Nick Ma * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 3 * of the License, or any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ import java.awt.Color; public class Main { public static Color getDarker(Color color, double factor) { return new Color(Math.max((int) (color.getRed() * factor), 0), Math.max((int) (color.getGreen() * factor), 0), Math.max((int) (color.getBlue() * factor), 0)); } }