本文整理汇总了Java中org.jfree.chart.title.TextTitle.setPaint方法的典型用法代码示例。如果您正苦于以下问题:Java TextTitle.setPaint方法的具体用法?Java TextTitle.setPaint怎么用?Java TextTitle.setPaint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.title.TextTitle
的用法示例。
在下文中一共展示了TextTitle.setPaint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
* Applies this theme to the supplied chart.
*
* @param chart the chart (<code>null</code> not permitted).
*/
@Override
public void apply(JFreeChart chart) {
ParamChecks.nullNotPermitted(chart, "chart");
TextTitle title = chart.getTitle();
if (title != null) {
title.setFont(this.extraLargeFont);
title.setPaint(this.titlePaint);
}
int subtitleCount = chart.getSubtitleCount();
for (int i = 0; i < subtitleCount; i++) {
applyToTitle(chart.getSubtitle(i));
}
chart.setBackgroundPaint(this.chartBackgroundPaint);
// now process the plot if there is one
Plot plot = chart.getPlot();
if (plot != null) {
applyToPlot(plot);
}
}
示例2: apply
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
* Applies this theme to the supplied chart.
*
* @param chart the chart ({@code null} not permitted).
*/
@Override
public void apply(JFreeChart chart) {
Args.nullNotPermitted(chart, "chart");
TextTitle title = chart.getTitle();
if (title != null) {
title.setFont(this.extraLargeFont);
title.setPaint(this.titlePaint);
}
int subtitleCount = chart.getSubtitleCount();
for (int i = 0; i < subtitleCount; i++) {
applyToTitle(chart.getSubtitle(i));
}
chart.setBackgroundPaint(this.chartBackgroundPaint);
// now process the plot if there is one
Plot plot = chart.getPlot();
if (plot != null) {
applyToPlot(plot);
}
}
示例3: setChartTitle
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
private void setChartTitle() {
JFreeChart chart = getCurrentChart();
if (chart != null) {
String text = plotInstance.getCurrentPlotConfigurationClone().getTitleText();
if (text == null) {
chart.setTitle(text);
return;
}
Font font = plotInstance.getCurrentPlotConfigurationClone().getTitleFont();
if (font == null) {
font = FontTools.getFont(Font.DIALOG, Font.PLAIN, 10);
}
TextTitle textTitle = new TextTitle(text, font);
textTitle.setPaint(plotInstance.getCurrentPlotConfigurationClone().getTitleColor());
chart.setTitle(textTitle);
}
}
示例4: apply
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
* Applies this theme to the supplied chart.
*
* @param chart the chart (<code>null</code> not permitted).
*/
public void apply(JFreeChart chart) {
if (chart == null) {
throw new IllegalArgumentException("Null 'chart' argument.");
}
TextTitle title = chart.getTitle();
if (title != null) {
title.setFont(this.extraLargeFont);
title.setPaint(this.titlePaint);
}
int subtitleCount = chart.getSubtitleCount();
for (int i = 0; i < subtitleCount; i++) {
applyToTitle(chart.getSubtitle(i));
}
chart.setBackgroundPaint(this.chartBackgroundPaint);
// now process the plot if there is one
Plot plot = chart.getPlot();
if (plot != null) {
applyToPlot(plot);
}
}
示例5: setBackgroundDefault
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
private final void setBackgroundDefault(final JFreeChart chart) {
final BasicStroke gridStroke =
new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
1.0f, new float[] { 2.0f, 1.0f }, 0.0f);
final XYPlot plot = (XYPlot) chart.getPlot();
plot.setRangeGridlineStroke(gridStroke);
plot.setDomainGridlineStroke(gridStroke);
plot.setBackgroundPaint(new Color(235, 235, 235));
plot.setRangeGridlinePaint(Color.white);
plot.setDomainGridlinePaint(Color.white);
plot.setOutlineVisible(false);
plot.getDomainAxis().setAxisLineVisible(false);
plot.getRangeAxis().setAxisLineVisible(false);
plot.getDomainAxis().setLabelPaint(Color.gray);
plot.getRangeAxis().setLabelPaint(Color.gray);
plot.getDomainAxis().setTickLabelPaint(Color.gray);
plot.getRangeAxis().setTickLabelPaint(Color.gray);
final TextTitle title = chart.getTitle();
if (title != null) title.setPaint(Color.black);
}
示例6: testEquals
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
* Problem that the equals(...) method distinguishes all fields.
*/
public void testEquals() {
TextTitle t1 = new TextTitle();
TextTitle t2 = new TextTitle();
assertEquals(t1, t2);
t1.setText("Test 1");
assertFalse(t1.equals(t2));
t2.setText("Test 1");
assertTrue(t1.equals(t2));
Font f = new Font("SansSerif", Font.PLAIN, 15);
t1.setFont(f);
assertFalse(t1.equals(t2));
t2.setFont(f);
assertTrue(t1.equals(t2));
t1.setPaint(Color.blue);
assertFalse(t1.equals(t2));
t2.setPaint(Color.blue);
assertTrue(t1.equals(t2));
t1.setBackgroundPaint(Color.blue);
assertFalse(t1.equals(t2));
t2.setBackgroundPaint(Color.blue);
assertTrue(t1.equals(t2));
}
示例7: testEquals
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
* Check that the equals() method distinguishes all fields.
*/
public void testEquals() {
TextTitle t1 = new TextTitle();
TextTitle t2 = new TextTitle();
assertEquals(t1, t2);
t1.setText("Test 1");
assertFalse(t1.equals(t2));
t2.setText("Test 1");
assertTrue(t1.equals(t2));
Font f = new Font("SansSerif", Font.PLAIN, 15);
t1.setFont(f);
assertFalse(t1.equals(t2));
t2.setFont(f);
assertTrue(t1.equals(t2));
t1.setTextAlignment(HorizontalAlignment.RIGHT);
assertFalse(t1.equals(t2));
t2.setTextAlignment(HorizontalAlignment.RIGHT);
assertTrue(t1.equals(t2));
// paint
t1.setPaint(new GradientPaint(1.0f, 2.0f, Color.red,
3.0f, 4.0f, Color.blue));
assertFalse(t1.equals(t2));
t2.setPaint(new GradientPaint(1.0f, 2.0f, Color.red,
3.0f, 4.0f, Color.blue));
assertTrue(t1.equals(t2));
// backgroundPaint
t1.setBackgroundPaint(new GradientPaint(4.0f, 3.0f, Color.red,
2.0f, 1.0f, Color.blue));
assertFalse(t1.equals(t2));
t2.setBackgroundPaint(new GradientPaint(4.0f, 3.0f, Color.red,
2.0f, 1.0f, Color.blue));
assertTrue(t1.equals(t2));
}
示例8: applyToTitle
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
* Applies the attributes of this theme to the specified title.
*
* @param title the title.
*/
protected void applyToTitle(Title title) {
if (title instanceof TextTitle) {
TextTitle tt = (TextTitle) title;
tt.setFont(this.largeFont);
tt.setPaint(this.subtitlePaint);
}
else if (title instanceof LegendTitle) {
LegendTitle lt = (LegendTitle) title;
if (lt.getBackgroundPaint() != null) {
lt.setBackgroundPaint(this.legendBackgroundPaint);
}
lt.setItemFont(this.regularFont);
lt.setItemPaint(this.legendItemPaint);
if (lt.getWrapper() != null) {
applyToBlockContainer(lt.getWrapper());
}
}
else if (title instanceof PaintScaleLegend) {
PaintScaleLegend psl = (PaintScaleLegend) title;
psl.setBackgroundPaint(this.legendBackgroundPaint);
ValueAxis axis = psl.getAxis();
if (axis != null) {
applyToValueAxis(axis);
}
}
else if (title instanceof CompositeTitle) {
CompositeTitle ct = (CompositeTitle) title;
BlockContainer bc = ct.getContainer();
List blocks = bc.getBlocks();
Iterator iterator = blocks.iterator();
while (iterator.hasNext()) {
Block b = (Block) iterator.next();
if (b instanceof Title) {
applyToTitle((Title) b);
}
}
}
}
示例9: getChartPanel
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
private ChartPanel getChartPanel() {
if (chartPanel == null) {
CombinedDomainXYPlot combinedDomainXYPlot = getCombinedDomainXYPlot();
JFreeChart jFreeChart = new JFreeChart(filename, JFreeChart.DEFAULT_TITLE_FONT, combinedDomainXYPlot,
false);
ChartUtilities.applyCurrentTheme(jFreeChart);
// customise the title position and font
TextTitle t = jFreeChart.getTitle();
t.setHorizontalAlignment(HorizontalAlignment.CENTER);
t.setPaint(Color.DARK_GRAY);
t.setFont(new Font("Arial", Font.BOLD, 12));
t.setPadding(10, 10, 5, 10);
chartPanel = new ChartPanel(jFreeChart);
chartPanel.setMinimumDrawWidth(0);
chartPanel.setMinimumDrawHeight(0);
chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE);
chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE);
chartPanel.setMouseWheelEnabled(true);
LogTableModel logTableModel = (LogTableModel) logTable.getModel();
NavigationTableController<Integer> navigationTableController;
navigationTableController = new NavigationTableController<Integer>(logTableModel);
navigationTableController.addCustomJTable(logTable);
chartPanel.addChartMouseListener(
new CombinedDomainXYPlotMouseListener(chartPanel, logTableModel, navigationTableController));
chartPanel.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
}
return chartPanel;
}
示例10: formatChart
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
* Sets all the format options on the given chart like fonts, chart title, legend, legend
* position etc.
*/
private void formatChart(JFreeChart chart) {
Plot plot = chart.getPlot();
PlotConfiguration currentPlotConfigurationClone = plotInstance.getCurrentPlotConfigurationClone();
// set plot background color
plot.setBackgroundPaint(currentPlotConfigurationClone.getPlotBackgroundColor());
formatLegend(chart);
// set chart background color
chart.setBackgroundPaint(currentPlotConfigurationClone.getChartBackgroundColor());
// add title to chart
String text = currentPlotConfigurationClone.getTitleText();
if (text == null) {
chart.setTitle(text);
} else {
Font font = currentPlotConfigurationClone.getTitleFont();
if (font == null) {
font = FontTools.getFont(Font.DIALOG, Font.PLAIN, 10);
}
TextTitle textTitle = new TextTitle(text, font);
textTitle.setPaint(currentPlotConfigurationClone.getTitleColor());
chart.setTitle(textTitle);
}
}
示例11: customizeTitle
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
protected void customizeTitle(TextTitle title, Font font)
{
title.setFont(font);
title.setTextAlignment(HorizontalAlignment.LEFT);
title.setPaint(Color.BLACK);
title.setBackgroundPaint(TRANSPARENT_COLOR);
}
示例12: customizeTitle
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
* <p>customizeTitle.</p>
*
* @param title a {@link org.jfree.chart.title.TextTitle} object.
* @param font a {@link java.awt.Font} object.
*/
protected void customizeTitle(TextTitle title, Font font)
{
title.setFont(font);
title.setTextAlignment(HorizontalAlignment.LEFT);
title.setPaint(Color.BLACK);
title.setBackgroundPaint(TRANSPARENT_COLOR);
}
示例13: createChart
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
* Creates a chart.
*
* @param dataset the dataset.
*
* @return A chart.
*/
private static JFreeChart createChart(PieDataset dataset) {
JFreeChart chart = ChartFactory.createPieChart(
"Smart Phones Manufactured / Q3 2011", dataset);
// set a custom background for the chart
chart.setBackgroundPaint(new GradientPaint(new Point(0, 0),
new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY));
// customise the title position and font
TextTitle t = chart.getTitle();
t.setHorizontalAlignment(HorizontalAlignment.LEFT);
t.setPaint(new Color(240, 240, 240));
t.setFont(new Font("Arial", Font.BOLD, 26));
PiePlot plot = (PiePlot) chart.getPlot();
plot.setBackgroundPaint(null);
plot.setInteriorGap(0.04);
plot.setOutlineVisible(false);
// use gradients and white borders for the section colours
plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
plot.setDefaultSectionOutlinePaint(Color.WHITE);
plot.setSectionOutlinesVisible(true);
plot.setDefaultSectionOutlineStroke(new BasicStroke(2.0f));
// customise the section label appearance
plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
plot.setLabelLinkPaint(Color.WHITE);
plot.setLabelLinkStroke(new BasicStroke(2.0f));
plot.setLabelOutlineStroke(null);
plot.setLabelPaint(Color.WHITE);
plot.setLabelBackgroundPaint(null);
// add a subtitle giving the data source
TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523",
new Font("Courier New", Font.PLAIN, 12));
source.setPaint(Color.WHITE);
source.setPosition(RectangleEdge.BOTTOM);
source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
chart.addSubtitle(source);
return chart;
}
示例14: createChart
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
* Creates a chart.
*
* @param dataset the dataset.
*
* @return A chart.
*/
private static JFreeChart createChart(PieDataset dataset) {
JFreeChart chart = ChartFactory.createPieChart(
"Smart Phones Manufactured / Q3 2011", // chart title
dataset, // data
false, // no legend
true, // tooltips
false // no URL generation
);
// set a custom background for the chart
chart.setBackgroundPaint(new GradientPaint(new Point(0, 0),
new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY));
// customise the title position and font
TextTitle t = chart.getTitle();
t.setHorizontalAlignment(HorizontalAlignment.LEFT);
t.setPaint(new Color(240, 240, 240));
t.setFont(new Font("Arial", Font.BOLD, 26));
PiePlot plot = (PiePlot) chart.getPlot();
plot.setBackgroundPaint(null);
plot.setInteriorGap(0.04);
// plot.setOutlineVisible(false);
// use gradients and white borders for the section colours
plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
plot.setBaseSectionOutlinePaint(Color.WHITE);
plot.setSectionOutlinesVisible(true);
plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));
// customise the section label appearance
plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
plot.setLabelLinkPaint(Color.WHITE);
plot.setLabelLinkStroke(new BasicStroke(2.0f));
plot.setLabelOutlineStroke(null);
plot.setLabelPaint(Color.WHITE);
plot.setLabelBackgroundPaint(null);
// add a subtitle giving the data source
TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523",
new Font("Courier New", Font.PLAIN, 12));
source.setPaint(Color.WHITE);
source.setPosition(RectangleEdge.BOTTOM);
source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
chart.addSubtitle(source);
return chart;
}
示例15: createChart
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
* Creates a chart.
*
* @param dataset the dataset.
*
* @return A chart.
*/
private static JFreeChart createChart(PieDataset dataset) {
JFreeChart chart = ChartFactory.createPieChart(
"Smart Phones Manufactured / Q3 2011", // chart title
dataset, // data
false, // no legend
true, // tooltips
false // no URL generation
);
// set a custom background for the chart
chart.setBackgroundPaint(new GradientPaint(new Point(0, 0),
new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY));
// customise the title position and font
TextTitle t = chart.getTitle();
t.setHorizontalAlignment(HorizontalAlignment.LEFT);
t.setPaint(new Color(240, 240, 240));
t.setFont(new Font("Arial", Font.BOLD, 26));
PiePlot plot = (PiePlot) chart.getPlot();
plot.setBackgroundPaint(null);
plot.setInteriorGap(0.04);
plot.setOutlineVisible(false);
// use gradients and white borders for the section colours
plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
plot.setBaseSectionOutlinePaint(Color.WHITE);
plot.setSectionOutlinesVisible(true);
plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));
// customise the section label appearance
plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
plot.setLabelLinkPaint(Color.WHITE);
plot.setLabelLinkStroke(new BasicStroke(2.0f));
plot.setLabelOutlineStroke(null);
plot.setLabelPaint(Color.WHITE);
plot.setLabelBackgroundPaint(null);
// add a subtitle giving the data source
TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523",
new Font("Courier New", Font.PLAIN, 12));
source.setPaint(Color.WHITE);
source.setPosition(RectangleEdge.BOTTOM);
source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
chart.addSubtitle(source);
return chart;
}