import org.eclipse.draw2d.ColorConstants; import org.eclipse.draw2d.Graphics; import org.eclipse.draw2d.RectangleFigure; import org.eclipse.draw2d.geometry.Rectangle; public class ColorLines extends RectangleFigure { @Override protected void fillShape(Graphics graphics) { Rectangle bounds = this.getBounds().getCopy(); this.setBackgroundColor(ColorConstants.green); super.fillShape(graphics); this.setForegroundColor(ColorConstants.blue); graphics.drawLine(bounds.x, bounds.y, bounds.x+bounds.width, bounds.y+bounds.height); this.setForegroundColor(ColorConstants.red); graphics.drawLine(bounds.x+bounds.width, bounds.y, bounds.x, bounds.y+bounds.height); } }