List of usage examples for org.jfree.chart.title LegendTitle setBackgroundPaint
public void setBackgroundPaint(Paint paint)
From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java
protected void setChartLegend(JFreeChart jfreeChart) { //The legend visibility is already taken into account in the jfreeChart object's constructor LegendTitle legend = jfreeChart.getLegend(); if (legend != null) { LegendSettings legendSettings = getLegendSettings(); JRBaseFont font = new JRBaseFont(); FontUtil.copyNonNullOwnProperties(legendSettings.getFont(), font); FontUtil.copyNonNullOwnProperties(getChart().getLegendFont(), font); font = new JRBaseFont(getChart(), font); legend.setItemFont(getFontUtil().getAwtFont(font, getLocale())); Paint forePaint = getChart().getOwnLegendColor(); if (forePaint == null && legendSettings.getForegroundPaint() != null) { forePaint = legendSettings.getForegroundPaint().getPaint(); }// w w w. ja v a 2 s .c o m if (forePaint == null) { forePaint = getChart().getLegendColor(); } if (forePaint != null) legend.setItemPaint(forePaint); Paint backPaint = getChart().getOwnLegendBackgroundColor(); if (backPaint == null && legendSettings.getBackgroundPaint() != null) { backPaint = legendSettings.getBackgroundPaint().getPaint(); } if (backPaint == null) { backPaint = getChart().getLegendBackgroundColor(); } if (backPaint != null) legend.setBackgroundPaint(backPaint); BlockFrame blockFrame = legendSettings.getBlockFrame(); if (blockFrame != null) legend.setFrame(blockFrame); HorizontalAlignment hAlign = legendSettings.getHorizontalAlignment(); if (hAlign != null) legend.setHorizontalAlignment(hAlign); VerticalAlignment vAlign = legendSettings.getVerticalAlignment(); if (vAlign != null) legend.setVerticalAlignment(vAlign); RectangleInsets padding = legendSettings.getPadding(); if (padding != null) legend.setPadding(padding); legend.setPosition(getEdge(getChart().getLegendPositionValue(), getEdge(legendSettings.getPositionValue(), RectangleEdge.BOTTOM))); } }