Folgendes Problem:
Meine "normale" paintBackground Methode sieht so aus:
Ich würde gerne auf den Hintergrund noch einen Kreis zeichnen. Nur wie stelle ich das an?
Das hier bewirkt gar nichts:
Kann mir da jemand weiterhelfen? Hab von Graphics2D und Paint kaum eine Ahnung :-/
Meine "normale" paintBackground Methode sieht so aus:
Code:
@Override
protected void paintBackground() {
Graphics2D gr = getScene().getGraphics();
Insets insets = getBorder().getInsets();
Rectangle bounds = getBounds();
Paint p = this.getBackground();
gr.setPaint(p);
if (this.getBorder().isOpaque()){
gr.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
}
else{
gr.fillRect(bounds.x + insets.left, bounds.y + insets.top,bounds.width - insets.left - insets.right, bounds.height - insets.top - insets.bottom);
}
}
Ich würde gerne auf den Hintergrund noch einen Kreis zeichnen. Nur wie stelle ich das an?
Das hier bewirkt gar nichts:
Code:
@Override
protected void paintBackground() {
Graphics2D gr = getScene().getGraphics();
Insets insets = getBorder().getInsets();
Rectangle bounds = getBounds();
Paint p = this.getBackground();
gr.setPaint(p);
if (this.getBorder().isOpaque()){
gr.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
}
else{
gr.fillRect(bounds.x + insets.left, bounds.y + insets.top,bounds.width - insets.left - insets.right, bounds.height - insets.top - insets.bottom);
}
Ellipse2D.Double ell = new Ellipse2D.Double(20,20,30,30);
gr.draw(ell);
}
Kann mir da jemand weiterhelfen? Hab von Graphics2D und Paint kaum eine Ahnung :-/