Here you can find the source of drawLightBeamVertical(Graphics g, Color c, int midx, int y1, int y2)
public static void drawLightBeamVertical(Graphics g, Color c, int midx, int y1, int y2)
//package com.java2s; /***/*from ww w .j a v a2 s . co m*/ * Copyright (C) 2010 Johan Henriksson * This code is under the Endrov / BSD license. See www.endrov.net * for the full text and how to cite. */ import java.awt.Color; import java.awt.Graphics; public class Main { private static final int beamR = 6; public static void drawLightBeamVertical(Graphics g, Color c, int midx, int y1, int y2) { float[] carr = new float[3]; c.getRGBColorComponents(carr); for (int i = -beamR; i < beamR; i++) { float weight = fmin1((beamR - Math.abs(i)) / (double) beamR); g.setColor(new Color(carr[0], carr[1], carr[2], weight)); g.drawLine(midx + i, y1, midx + i, y2); } } private static float fmin1(double x) { return Math.max(Math.min(0.9f, (float) x), 0f); } }