List of usage examples for java.awt RadialGradientPaint RadialGradientPaint
public RadialGradientPaint(Point2D center, float radius, Point2D focus, float[] fractions, Color[] colors, CycleMethod cycleMethod)
From source file:Main.java
/** * Creates a nifty looking inner shadow for the window. * @param width The width of the shadow. * @param height The height of the shadow. * @return The translucent shadow that was created. */// w ww .jav a 2 s . c om public static BufferedImage genInnerShadow(int width, int height) { BufferedImage shadowOuter = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics g = shadowOuter.getGraphics(); Graphics2D g2 = (Graphics2D) g; Point2D center = new Point2D.Float(width / 2, height / 2); float radius = width; Point2D focus = new Point2D.Float(width / 2, height / 2); float[] dist = { 0.0f, 1.0f }; Color[] colors = { new Color(0, 0, 0, 0), new Color(0, 0, 0, 220) }; RadialGradientPaint p = new RadialGradientPaint(center, radius, focus, dist, colors, CycleMethod.NO_CYCLE); g2.setPaint(p); g2.fillRect(0, 0, width, height); return shadowOuter; }