org.jdesktop.swingx.painter.BusyPainter Maven / Gradle / Ivy
/*
* $Id: BusyPainter.java,v 1.5 2007/03/26 21:25:19 rbair Exp $
*
* Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle,
* Santa Clara, California 95054, U.S.A. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.jdesktop.swingx.painter;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.RoundRectangle2D;
import org.jdesktop.swingx.color.ColorUtil;
/**
* A specific painter that paints an "infinite progress" like animation.
*
*/
public class BusyPainter extends AbstractPainter {
private int frame = -1;
private boolean skewed = false;
private int points = 8;
private float barWidth = 4;
private float barLength = 8;
private float centerDistance = 5;
private Color baseColor = new Color(200,200,200);
private Color highlightColor = Color.BLACK;
private int trailLength = 4;
/**
* @inheritDoc
*/
@Override
protected void doPaint(Graphics2D g, T t, int width, int height) {
RoundRectangle2D rect = new RoundRectangle2D.Float(getCenterDistance(), -getBarWidth()/2,
getBarLength(), getBarWidth(),
getBarWidth(), getBarWidth());
if(skewed) {
rect = new RoundRectangle2D.Float(5,getBarWidth()/2,8, getBarWidth(),
getBarWidth(), getBarWidth());
}
g.setColor(Color.GRAY);
g.translate(width/2,height/2);
for(int i=0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy