org.jfree.chart.title.TextTitle.setText()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(77)

本文整理了Java中org.jfree.chart.title.TextTitle.setText()方法的一些代码示例,展示了TextTitle.setText()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextTitle.setText()方法的具体详情如下:
包路径:org.jfree.chart.title.TextTitle
类名称:TextTitle
方法名:setText

TextTitle.setText介绍

[英]Sets the title to the specified text and sends a TitleChangeEvent to all registered listeners.
[中]将标题设置为指定的文本,并向所有注册的侦听器发送TitleChangeEvent。

代码示例

代码示例来源:origin: jfree/jfreechart

/**
 * Sets the chart title and sends a {@link ChartChangeEvent} to all
 * registered listeners.  This is a convenience method that ends up calling
 * the {@link #setTitle(TextTitle)} method.  If there is an existing title,
 * its text is updated, otherwise a new title using the default font is
 * added to the chart.  If {@code text} is {@code null} the chart
 * title is set to {@code null}.
 *
 * @param text  the title text ({@code null} permitted).
 *
 * @see #getTitle()
 */
public void setTitle(String text) {
  if (text != null) {
    if (this.title == null) {
      setTitle(new TextTitle(text, JFreeChart.DEFAULT_TITLE_FONT));
    } else {
      this.title.setText(text);
    }
  }
  else {
    setTitle((TextTitle) null);
  }
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-chart

/**
 * Sets the chart title and sends a {@link ChartChangeEvent} to all
 * registered listeners.  This is a convenience method that ends up calling
 * the {@link #setTitle(TextTitle)} method.  If there is an existing title,
 * its text is updated, otherwise a new title using the default font is
 * added to the chart.  If <code>text</code> is <code>null</code> the chart
 * title is set to <code>null</code>.
 *
 * @param text  the title text (<code>null</code> permitted).
 *
 * @see #getTitle()
 */
public void setTitle(String text) {
  if (text != null) {
    if (this.title == null) {
      setTitle(new TextTitle(text, JFreeChart.DEFAULT_TITLE_FONT));
    }
    else {
      this.title.setText(text);
    }
  }
  else {
    setTitle((TextTitle) null);
  }
}

代码示例来源:origin: dhis2/dhis2-core

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;
}

代码示例来源:origin: org.n52.sensorweb/timeseries-io

private void addNotice(JFreeChart chart) {
  TextTitle notice = new TextTitle();
  String msg = i18n.get("notice");
  if (msg != null && !msg.isEmpty()) {
    notice.setText(msg);
    notice.setPaint(BLACK);
    notice.setFont(FONT_LABEL_SMALL);
    notice.setPosition(RectangleEdge.BOTTOM);
    notice.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    notice.setVerticalAlignment(VerticalAlignment.BOTTOM);
    notice.setPadding(new RectangleInsets(0, 0, 20, 20));
    chart.addSubtitle(notice);
  }
}

代码示例来源:origin: org.n52.series-api/io

private void addNotice(JFreeChart chart) {
  TextTitle notice = new TextTitle();
  String msg = i18n.get("msg.io.chart.notice");
  if (msg != null && !msg.isEmpty()) {
    notice.setText(msg);
    notice.setPaint(Color.BLACK);
    notice.setFont(LabelConstants.FONT_LABEL_SMALL);
    notice.setPosition(RectangleEdge.BOTTOM);
    notice.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    notice.setVerticalAlignment(VerticalAlignment.BOTTOM);
    notice.setPadding(new RectangleInsets(0, 0, 20, 20));
    chart.addSubtitle(notice);
  }
}

代码示例来源:origin: jfree/jfreechart

/**
 * Sets the properties of the specified title to match the properties
 * defined on this panel.
 *
 * @param chart  the chart whose title is to be modified.
 */
public void setTitleProperties(JFreeChart chart) {
  if (this.showTitle) {
    TextTitle title = chart.getTitle();
    if (title == null) {
      title = new TextTitle();
      chart.setTitle(title);
    }
    title.setText(getTitleText());
    title.setFont(getTitleFont());
    title.setPaint(getTitlePaint());
  }
  else {
    chart.setTitle((TextTitle) null);
  }
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-chart

/**
 * Sets the properties of the specified title to match the properties
 * defined on this panel.
 *
 * @param chart  the chart whose title is to be modified.
 */
public void setTitleProperties(JFreeChart chart) {
  if (this.showTitle) {
    TextTitle title = chart.getTitle();
    if (title == null) {
      title = new TextTitle();
      chart.setTitle(title);
    }
    title.setText(getTitleText());
    title.setFont(getTitleFont());
    title.setPaint(getTitlePaint());
  }
  else {
    chart.setTitle((TextTitle) null);
  }
}

代码示例来源:origin: sc.fiji/Simple_Neurite_Tracer

protected synchronized void updateResults() {
  JFreeChart chart;
  if (numberOfAllPaths <= 0) {
    makePromptInteractive(false);
    if (graphFrame != null) {
      chart = graphFrame.chartPanel.getChart();
      if (chart != null) {
        chart.setNotify(false);
        final TextTitle currentitle = chart.getTitle();
        if (currentitle != null)
          currentitle.setText("");
        final XYPlot plot = chart.getXYPlot();
        if (plot != null)
          plot.setDataset(null);
        chart.setNotify(true);
      }
    }
  } else { // valid paths to be analyzed
    makePromptInteractive(true);
    final ShollResults results = getCurrentResults();
    resultsPanel.updateFromResults(results);
    chart = results.createGraph();
    if (chart == null)
      return;
    if (graphFrame == null)
      graphFrame = new GraphFrame(chart, results.getSuggestedSuffix());
    else
      graphFrame.updateWithNewChart(chart, results.getSuggestedSuffix());
  }
}

相关文章