You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
2.1 KiB
88 lines
2.1 KiB
/*
|
|
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
|
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*/
|
|
package javax.swing.plaf.nimbus;
|
|
|
|
import java.awt.*;
|
|
import java.awt.geom.*;
|
|
import java.awt.image.*;
|
|
import javax.swing.*;
|
|
import javax.swing.Painter;
|
|
|
|
|
|
final class ScrollBarPainter extends AbstractRegionPainter {
|
|
//package private integers representing the available states that
|
|
//this painter will paint. These are used when creating a new instance
|
|
//of ScrollBarPainter to determine which region/state is being painted
|
|
//by that instance.
|
|
|
|
|
|
private int state; //refers to one of the static final ints above
|
|
private PaintContext ctx;
|
|
|
|
//the following 4 variables are reused during the painting code of the layers
|
|
private Path2D path = new Path2D.Float();
|
|
private Rectangle2D rect = new Rectangle2D.Float(0, 0, 0, 0);
|
|
private RoundRectangle2D roundRect = new RoundRectangle2D.Float(0, 0, 0, 0, 0, 0);
|
|
private Ellipse2D ellipse = new Ellipse2D.Float(0, 0, 0, 0);
|
|
|
|
//All Colors used for painting are stored here. Ideally, only those colors being used
|
|
//by a particular instance of ScrollBarPainter would be created. For the moment at least,
|
|
//however, all are created for each instance.
|
|
|
|
|
|
//Array of current component colors, updated in each paint call
|
|
private Object[] componentColors;
|
|
|
|
public ScrollBarPainter(PaintContext ctx, int state) {
|
|
super();
|
|
this.state = state;
|
|
this.ctx = ctx;
|
|
}
|
|
|
|
@Override
|
|
protected void doPaint(Graphics2D g, JComponent c, int width, int height, Object[] extendedCacheKeys) {
|
|
//populate componentColors array with colors calculated in getExtendedCacheKeys call
|
|
componentColors = extendedCacheKeys;
|
|
//generate this entire method. Each state/bg/fg/border combo that has
|
|
//been painted gets its own KEY and paint method.
|
|
switch(state) {
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
protected final PaintContext getPaintContext() {
|
|
return ctx;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|