2129N/A/*
2362N/A * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
2129N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2129N/A *
2129N/A * This code is free software; you can redistribute it and/or modify it
2129N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
2129N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
2129N/A *
2129N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2129N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2129N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2129N/A * version 2 for more details (a copy is included in the LICENSE file that
2129N/A * accompanied this code).
2129N/A *
2129N/A * You should have received a copy of the GNU General Public License version
2129N/A * 2 along with this work; if not, write to the Free Software Foundation,
2129N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2129N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
2129N/A */
2129N/A
2129N/A/*
2129N/A * Image generator for cursor and drag
2129N/A */
2129N/Aimport java.awt.Color;
2129N/Aimport java.awt.Graphics;
2129N/Aimport java.awt.Image;
2129N/Aimport java.awt.image.BufferedImage;
2129N/A
2129N/Apublic abstract class ImageGenerator
2129N/A{
2129N/A public int width;
2129N/A public int height;
2129N/A private final BufferedImage bi;
2129N/A public ImageGenerator(int _width, int _height, Color bgColor)
2129N/A {
2129N/A width = _width;
2129N/A height = _height;
2129N/A bi = new BufferedImage(
2129N/A width,
2129N/A height,
2129N/A BufferedImage.TYPE_INT_ARGB);
2129N/A Graphics gr = bi.getGraphics();
2129N/A if(null==bgColor){
2129N/A bgColor = Color.WHITE;
2129N/A }
2129N/A gr.setColor(bgColor);
2129N/A gr.fillRect(0, 0, width, height);
2129N/A paint(gr);
2129N/A gr.dispose();
2129N/A }
2129N/A public Image getImage() { return bi; }
2129N/A
2129N/A public abstract void paint(Graphics gr);
2129N/A}