Here you can find the source of paintListGradientSelection(Graphics2D graphics2D, Component component, int width, int height)
public static void paintListGradientSelection(Graphics2D graphics2D, Component component, int width, int height)
//package com.java2s; /******************************************************************************* * Copyright (c) 2011 Zeljko Zirikovic.//from w w w. ja va2s .c om * All rights reserved. This program and the accompanying materials * are made available under the terms of the GPL which * accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html ******************************************************************************/ import java.awt.Color; import java.awt.Component; import java.awt.GradientPaint; import java.awt.Graphics2D; public class Main { private static Color LIST_TOP_LINE_COLOR = new Color(255, 235, 180); private static Color LIST_TOP_GRADIENT_COLOR = new Color(255, 243, 186); private static Color LIST_BOTTOM_GRADIENT_COLOR = new Color(255, 223, 166); public static void paintListGradientSelection(Graphics2D graphics2D, Component component, int width, int height) { paintGradientSelection(LIST_TOP_LINE_COLOR, LIST_BOTTOM_GRADIENT_COLOR, LIST_TOP_GRADIENT_COLOR, LIST_BOTTOM_GRADIENT_COLOR, graphics2D, width, height); } private static void paintGradientSelection(Color topLineColor, Color bottomLineColor, Color topGradientColor, Color bottomGradientColor, Graphics2D graphics2D, int width, int height) { GradientPaint paint = new GradientPaint(0, 1, topGradientColor, 0, height - 2, bottomGradientColor); graphics2D.setPaint(paint); graphics2D.fillRect(0, 0, width, height); graphics2D.setColor(topLineColor); graphics2D.drawLine(0, 0, width, 0); graphics2D.setColor(bottomLineColor); graphics2D.drawLine(0, height - 1, width, height - 1); } }