Java Color Value getColorTercio(Color a, Color b)

Here you can find the source of getColorTercio(Color a, Color b)

Description

get Color Tercio

License

Open Source License

Declaration

static ColorUIResource getColorTercio(Color a, Color b) 

Method Source Code

//package com.java2s;
/*/*from ww  w .j  a v a2  s .c  o  m*/
 *                 (C) Copyright 2005 Nilo J. Gonzalez
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser Gereral Public Licence as published by the Free
 * Software Foundation; either version 2 of the Licence, or (at your opinion) any
 * later version.
 * 
 * This library is distributed in the hope that it will be usefull, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of merchantability or fitness for a
 * particular purpose. See the GNU Lesser General Public Licence for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public Licence along
 * with this library; if not, write to the Free Software Foundation, Inc., 59
 * Temple Place, Suite 330, Boston, Ma 02111-1307 USA.
 *
 * http://www.gnu.org/licenses/lgpl.html (English)
 * http://gugs.sindominio.net/gnu-gpl/lgpl-es.html (Espa?ol)
 *
 *
 * Original author: Nilo J. Gonzalez
 */

import java.awt.*;

import javax.swing.plaf.ColorUIResource;

public class Main {
    static ColorUIResource getColorTercio(Color a, Color b) {
        return new ColorUIResource(propInt(a.getRed(), b.getRed(), 3),
                propInt(a.getGreen(), b.getGreen(), 3), propInt(
                        a.getBlue(), b.getBlue(), 3));
    }

    private static int propInt(int a, int b, int prop) {
        return b + ((a - b) / prop);
    }
}

Related

  1. getBorder(Color clr, int thickness)
  2. getColorBackground()
  3. getColorChooser()
  4. getColorForeground()
  5. getColorLabels(Object obj)
  6. getColorValue(Element element, Object constant)
  7. getDefaultBackgroundColor()
  8. getDefaultBackgroundColor(Color color)
  9. getDerivedColor(Color color, float ratio)