1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.scenegraph.g2d.nodes;
14 import java.awt.Color;
15 import java.awt.Graphics2D;
16 import java.awt.Paint;
17 import java.awt.geom.Rectangle2D;
19 import org.simantics.scenegraph.g2d.G2DNode;
21 public class BackgroundNode extends G2DNode {
25 private static final long serialVersionUID = 2805713128639560702L;
27 protected Color color = null;
28 protected Paint paint = null;
29 protected Rectangle2D bounds = null;
32 public void setColor(Color color) {
37 public void setPaint(Paint paint) {
42 public void setBounds(Rectangle2D bounds) {
47 public void render(Graphics2D g) {
48 Rectangle2D drawBounds = bounds;
49 if(drawBounds == null) {
50 drawBounds = (Rectangle2D)g.getClipBounds().clone(); // Fill whole clip area if bounds is not defined
64 public String toString() {
65 return super.toString() + " [color=" + color + "]";
69 public Rectangle2D getBoundsInLocal() {