Java Graphics Draw Gradient paintGradientSelection(Color topLineColor, Color bottomLineColor, Color topGradientColor, Color bottomGradientColor, Graphics2D graphics2D, int width, int height)

Here you can find the source of paintGradientSelection(Color topLineColor, Color bottomLineColor, Color topGradientColor, Color bottomGradientColor, Graphics2D graphics2D, int width, int height)

Description

paint Gradient Selection

License

Open Source License

Declaration

private static void paintGradientSelection(Color topLineColor, Color bottomLineColor, Color topGradientColor,
            Color bottomGradientColor, Graphics2D graphics2D, int width, int height) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2011 Zeljko Zirikovic.//w  w w .  ja  va2 s  .co m
 * 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.GradientPaint;
import java.awt.Graphics2D;

public class Main {
    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);
    }
}

Related

  1. DrawGradient(Graphics g, int x, int y, int width, int height, Color color1, Color color2)
  2. linearGradient(final JComponent comp, final Color col, final int step, final int sleepTime)
  3. paintGradient(Graphics g, JComponent comp, Color color1, Color color2)
  4. paintHorizontalGradient2D(Graphics2D g, int x, int y, int w, int h, float g1, float g2, Color c1, Color c2, Color c3, int[][] mask)
  5. paintListGradientSelection(Graphics2D graphics2D, Component component, int width, int height)
  6. paintMacGradientFill(Graphics2D g, Rectangle rect, Color brightC, Color darkC)
  7. paintVerticalGradient2D(Graphics2D g, int x, int y, int w, int h, float g1, float g2, Color c1, Color c2, Color c3, int[][] mask)