Ich zeichne Schatten auf undecorated Jframe
mit GradientPaint
Klasse Unter Windows OS ist alles in Ordnung. Aber auf Mac OS, wenn ich Java 7/8 Schatten wähle, ist größer dann in Java 6. Was mache ich falsch?Warum zeichnet GradientPaint anders in Java 6 und Java 7/8 auf MAC OS
public class DropShadowPanel extends JPanel() {
//class fields and constructor
.....
@Override
protected void paintComponent(Graphics gr) {
super.paintComponent(gr);
Graphics2D g = (Graphics2D) gr;
Rectangle2D r = new Rectangle2D.Double(shadowDistance,shadowDistance, 300, 300);
draw(g, r, shadowSize);
}
private void draw(Graphics2D g, Rectangle2D r, double shadowSize) {
Color c0 = shadowColor;
//c1 - full opacity color
Color c1 = new Color(255, 255, 255, 0);
double x0 = r.getMinX();
double y0 = r.getMinY();
double x1 = r.getMaxX();
double y1 = r.getMaxY();
double w = r.getWidth();
double h = r.getHeight();
// Left
g.setPaint(new GradientPaint(
new Point2D.Double(x0, y0), c0,
new Point2D.Double(x0 - s, y0), c1));
g.fill(new Rectangle2D.Double(x0 - s, y0, s, h));
//draw the remaining sides
.....
}
}