@Test public void testGetSubtitle() { DefaultPieDataset dataset = new DefaultPieDataset(); JFreeChart chart = ChartFactory.createPieChart("title", dataset); Title t = chart.getSubtitle(0); assertTrue(t instanceof LegendTitle); try { chart.getSubtitle(-1); fail("Should have thrown an IllegalArgumentException on negative number"); } catch (IllegalArgumentException e) { assertEquals("Index out of range.", e.getMessage()); } try { chart.getSubtitle(1); fail("Should have thrown an IllegalArgumentException on excesive number"); } catch (IllegalArgumentException e) { assertEquals("Index out of range.", e.getMessage()); } try { chart.getSubtitle(2); fail("Should have thrown an IllegalArgumentException on number being out of range"); } catch (IllegalArgumentException e) { assertEquals("Index out of range.", e.getMessage()); } }
public Title getSubtitle(int index) { if ((index < 0) || (index >= getSubtitleCount())) { throw new IllegalArgumentException("Index out of range."); } return this.subtitles.get(index); }
JFreeChart implements Drawable, TitleChangeListener,
        PlotChangeListener, Serializable, Cloneable { public Title getSubtitle(int index) { if ((index < 0) || (index >= getSubtitleCount())) { throw new IllegalArgumentException("Index out of range."); } return this.subtitles.get(index); } }
JFreeChart implements Drawable, TitleChangeListener,
        PlotChangeListener, Serializable, Cloneable { public Title getSubtitle(int index) { if ((index < 0) || (index >= getSubtitleCount())) { throw new IllegalArgumentException("Index out of range."); } return this.subtitles.get(index); } JFreeChart(Plot plot);  JFreeChart(String title, Plot plot);  JFreeChart(String title, Font titleFont, Plot plot,
                      boolean createLegend); }
JFreeChart implements Drawable, TitleChangeListener,
        PlotChangeListener, Serializable, Cloneable { public Title getSubtitle(int index) { if ((index < 0) || (index >= getSubtitleCount())) { throw new IllegalArgumentException("Index out of range."); } return this.subtitles.get(index); } JFreeChart(Plot plot);  JFreeChart(String title, Plot plot);  JFreeChart(String title, Font titleFont, Plot plot,
                      boolean createLegend); RenderingHints getRenderingHints(); void setRenderingHints(RenderingHints hints); boolean isBorderVisible(); void setBorderVisible(boolean visible); Stroke getBorderStroke(); void setBorderStroke(Stroke stroke); Paint getBorderPaint(); void setBorderPaint(Paint paint); RectangleInsets getPadding(); void setPadding(RectangleInsets padding); TextTitle getTitle(); void setTitle(TextTitle title); void setTitle(String text); void addLegend(LegendTitle legend); LegendTitle getLegend(); LegendTitle getLegend(int index); void removeLegend(); List<Title> getSubtitles(); void setSubtitles(List<? extends Title> subtitles); int getSubtitleCount(); Title getSubtitle(int index); void addSubtitle(Title subtitle); void addSubtitle(int index, Title subtitle); void clearSubtitles(); void removeSubtitle(Title title); Plot getPlot(); boolean getAntiAlias(); void setAntiAlias(boolean flag); Object getTextAntiAlias(); void setTextAntiAlias(boolean flag); void setTextAntiAlias(Object val); Paint getBackgroundPaint(); void setBackgroundPaint(Paint paint); Image getBackgroundImage(); void setBackgroundImage(Image image); int getBackgroundImageAlignment(); void setBackgroundImageAlignment(int alignment); float getBackgroundImageAlpha(); void setBackgroundImageAlpha(float alpha); boolean isNotify(); void setNotify(boolean notify); @Override void draw(Graphics2D g2, Rectangle2D area); void draw(Graphics2D g2, Rectangle2D area, ChartRenderingInfo info); void draw(Graphics2D g2, Rectangle2D chartArea, Point2D anchor,
                     ChartRenderingInfo info); BufferedImage createBufferedImage(int width, int height); BufferedImage createBufferedImage(int width, int height,
                                             ChartRenderingInfo info); BufferedImage createBufferedImage(int width, int height,
                                             int imageType,
                                             ChartRenderingInfo info); BufferedImage createBufferedImage(int imageWidth,
                                             int imageHeight,
                                             double drawWidth,
                                             double drawHeight,
                                             ChartRenderingInfo info); void handleClick(int x, int y, ChartRenderingInfo info); void addChangeListener(ChartChangeListener listener); void removeChangeListener(ChartChangeListener listener); void fireChartChanged(); void addProgressListener(ChartProgressListener listener); void removeProgressListener(ChartProgressListener listener); @Override void titleChanged(TitleChangeEvent event); @Override void plotChanged(PlotChangeEvent event); @Override boolean equals(Object obj); @Override Object clone(); }
JFreeChart implements Drawable, TitleChangeListener,
        PlotChangeListener, Serializable, Cloneable { public Title getSubtitle(int index) { if ((index < 0) || (index >= getSubtitleCount())) { throw new IllegalArgumentException("Index out of range."); } return this.subtitles.get(index); } JFreeChart(Plot plot);  JFreeChart(String title, Plot plot);  JFreeChart(String title, Font titleFont, Plot plot,
                      boolean createLegend); RenderingHints getRenderingHints(); void setRenderingHints(RenderingHints hints); boolean isBorderVisible(); void setBorderVisible(boolean visible); Stroke getBorderStroke(); void setBorderStroke(Stroke stroke); Paint getBorderPaint(); void setBorderPaint(Paint paint); RectangleInsets getPadding(); void setPadding(RectangleInsets padding); TextTitle getTitle(); void setTitle(TextTitle title); void setTitle(String text); void addLegend(LegendTitle legend); LegendTitle getLegend(); LegendTitle getLegend(int index); void removeLegend(); List<Title> getSubtitles(); void setSubtitles(List<? extends Title> subtitles); int getSubtitleCount(); Title getSubtitle(int index); void addSubtitle(Title subtitle); void addSubtitle(int index, Title subtitle); void clearSubtitles(); void removeSubtitle(Title title); Plot getPlot(); boolean getAntiAlias(); void setAntiAlias(boolean flag); Object getTextAntiAlias(); void setTextAntiAlias(boolean flag); void setTextAntiAlias(Object val); Paint getBackgroundPaint(); void setBackgroundPaint(Paint paint); Image getBackgroundImage(); void setBackgroundImage(Image image); int getBackgroundImageAlignment(); void setBackgroundImageAlignment(int alignment); float getBackgroundImageAlpha(); void setBackgroundImageAlpha(float alpha); boolean isNotify(); void setNotify(boolean notify); @Override void draw(Graphics2D g2, Rectangle2D area); void draw(Graphics2D g2, Rectangle2D area, ChartRenderingInfo info); void draw(Graphics2D g2, Rectangle2D chartArea, Point2D anchor,
                     ChartRenderingInfo info); BufferedImage createBufferedImage(int width, int height); BufferedImage createBufferedImage(int width, int height,
                                             ChartRenderingInfo info); BufferedImage createBufferedImage(int width, int height,
                                             int imageType,
                                             ChartRenderingInfo info); BufferedImage createBufferedImage(int imageWidth,
                                             int imageHeight,
                                             double drawWidth,
                                             double drawHeight,
                                             ChartRenderingInfo info); void handleClick(int x, int y, ChartRenderingInfo info); void addChangeListener(ChartChangeListener listener); void removeChangeListener(ChartChangeListener listener); void fireChartChanged(); void addProgressListener(ChartProgressListener listener); void removeProgressListener(ChartProgressListener listener); @Override void titleChanged(TitleChangeEvent event); @Override void plotChanged(PlotChangeEvent event); @Override boolean equals(Object obj); @Override Object clone(); static final Font DEFAULT_TITLE_FONT; static final Paint DEFAULT_BACKGROUND_PAINT; static final Image DEFAULT_BACKGROUND_IMAGE; static final int DEFAULT_BACKGROUND_IMAGE_ALIGNMENT; static final float DEFAULT_BACKGROUND_IMAGE_ALPHA; static final RenderingHints.Key KEY_SUPPRESS_SHADOW_GENERATION; }