本文整理汇总了Java中org.jfree.chart.title.TextTitle.setFont方法的典型用法代码示例。如果您正苦于以下问题:Java TextTitle.setFont方法的具体用法?Java TextTitle.setFont怎么用?Java TextTitle.setFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.title.TextTitle
的用法示例。
在下文中一共展示了TextTitle.setFont方法的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: 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);
}
}
示例4: 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));
}
示例5: 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));
}
示例6: testTitleChangeEvent
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
* Some checks for title changes and event notification.
*/
@Test
public void testTitleChangeEvent() {
DefaultPieDataset dataset = new DefaultPieDataset();
JFreeChart chart = ChartFactory.createPieChart("title", dataset);
chart.addChangeListener(this);
this.lastChartChangeEvent = null;
TextTitle t = chart.getTitle();
t.setFont(new Font("Dialog", Font.BOLD, 9));
assertNotNull(this.lastChartChangeEvent);
this.lastChartChangeEvent = null;
// now create a new title and replace the existing title, several
// things should happen:
// (1) Adding the new title should trigger an immediate
// ChartChangeEvent;
// (2) Modifying the new title should trigger a ChartChangeEvent;
// (3) Modifying the old title should NOT trigger a ChartChangeEvent
TextTitle t2 = new TextTitle("T2");
chart.setTitle(t2);
assertNotNull(this.lastChartChangeEvent);
this.lastChartChangeEvent = null;
t2.setFont(new Font("Dialog", Font.BOLD, 9));
assertNotNull(this.lastChartChangeEvent);
this.lastChartChangeEvent = null;
t.setFont(new Font("Dialog", Font.BOLD, 9));
assertNull(this.lastChartChangeEvent);
this.lastChartChangeEvent = null;
}
示例7: 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);
}
}
}
}
示例8: setSubTitle
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
* This method renders a subtitle above the graph, in case the subtitle string is not null or "". Set the subTitle in the jsp via the param tag,
* using the keyword "subtitle": <cewolf:chartpostprocessor id="chartPostProcessorImpl" > <cewolf:param name="subtitle"
* value="${dataTable.subTitle}"/> </cewolf:chartpostprocessor>
* @param chart
* @param params
*/
@SuppressWarnings("rawtypes")
private void setSubTitle(final Object chart, final Map params) {
final String subtitleString = (String) params.get("subtitle");
if (subtitleString != null && subtitleString.trim().length() > 0) {
final TextTitle subtitle = new TextTitle(subtitleString);
subtitle.setFont(subtitle.getFont().deriveFont(11f)); // TODO font size may be parameterized later on???
((JFreeChart) chart).addSubtitle(subtitle);
}
}
示例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: getSubTitle
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
private TextTitle getSubTitle( BaseChart chart )
{
TextTitle textTitle = new TextTitle();
String title = chart.hasTitle() ? chart.getTitle() : chart.generateTitle();
textTitle.setFont( SUB_TITLE_FONT );
textTitle.setText( title );
return 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: getSubTitle
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
private TextTitle getSubTitle( BaseChart chart )
{
TextTitle textTitle = new TextTitle();
String title = chart.hasTitle() ? chart.getTitle() : chart.generateTitle();
textTitle.setFont( SUB_TITLE_FONT );
textTitle.setText( title );
return textTitle;
}
示例14: testTitleChangeEvent
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
* Some checks for title changes and event notification.
*/
public void testTitleChangeEvent() {
DefaultPieDataset dataset = new DefaultPieDataset();
JFreeChart chart = ChartFactory.createPieChart("title", dataset, true);
chart.addChangeListener(this);
this.lastChartChangeEvent = null;
TextTitle t = chart.getTitle();
t.setFont(new Font("Dialog", Font.BOLD, 9));
assertNotNull(this.lastChartChangeEvent);
this.lastChartChangeEvent = null;
// now create a new title and replace the existing title, several
// things should happen:
// (1) Adding the new title should trigger an immediate
// ChartChangeEvent;
// (2) Modifying the new title should trigger a ChartChangeEvent;
// (3) Modifying the old title should NOT trigger a ChartChangeEvent
TextTitle t2 = new TextTitle("T2");
chart.setTitle(t2);
assertNotNull(this.lastChartChangeEvent);
this.lastChartChangeEvent = null;
t2.setFont(new Font("Dialog", Font.BOLD, 9));
assertNotNull(this.lastChartChangeEvent);
this.lastChartChangeEvent = null;
t.setFont(new Font("Dialog", Font.BOLD, 9));
assertNull(this.lastChartChangeEvent);
this.lastChartChangeEvent = null;
}
示例15: erstelleKuchenDiagramm
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
* Erstellt ein Kuchendiagramm aus den Parametern.
*
* @param dataset
* Datenset
* @param titel
* Titel
* @return {@link JFreeChart}
*/
private JFreeChart erstelleKuchenDiagramm(PieDataset dataset, String titel) {
JFreeChart chart = ChartFactory.createPieChart3D(titel, dataset, true,
true, false);
TextTitle t = chart.getTitle();
t.setHorizontalAlignment(HorizontalAlignment.CENTER);
t.setFont(new Font("Arial", Font.CENTER_BASELINE, 26));
PiePlot plot = (PiePlot) chart.getPlot();
plot.setBackgroundPaint(null);
plot.setInteriorGap(0.04);
plot.setOutlineVisible(false);
for (Partei partei : parteienListe) {
if (partei.getFarbe() != null) {
plot.setSectionPaint(
partei.getName(),
createGradientPaint(partei.getFarbe(),
partei.getFarbe()));
}
}
plot.setBaseSectionOutlinePaint(Color.GRAY);
plot.setLabelFont(new Font("Arial", Font.BOLD, 15));
plot.setLabelLinkPaint(Color.black);
plot.setLabelPaint(Color.black);
plot.setLabelBackgroundPaint(null);
return chart;
}