List of usage examples for java.awt Font BOLD
int BOLD
To view the source code for java.awt Font BOLD.
Click Source Link
From source file:net.sf.dynamicreports.test.jasper.chart.StackedAreaChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);/*w w w . j a v a 2 s . c o m*/ JFreeChart chart = getChart("summary.chart1", 0); Axis axis = chart.getCategoryPlot().getDomainAxis(); CategoryPlot categoryPlot = chart.getCategoryPlot(); Assert.assertEquals("renderer", StackedAreaRenderer.class, categoryPlot.getRenderer().getClass()); Assert.assertEquals("category label", "category", axis.getLabel()); Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions() .getLabelPosition(RectangleEdge.LEFT); Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); chart = getChart("summary.chart2", 0); axis = chart.getCategoryPlot().getRangeAxis(); Assert.assertEquals("value label", "value", axis.getLabel()); Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10)); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound()); Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound()); }
From source file:com.pronoiahealth.olhie.server.services.BookCoverImageService.java
/** * Initialize the various maps, fonts, etc.. *///from w w w .j a va 2 s . c o m @PostConstruct protected void postActivate() { try { // Init the coverMap and load the images coverMap = new HashMap<String, byte[]>(); List<BookCover> covers = coverDisplayData.getCovers(); for (BookCover cover : covers) { coverMap.put(cover.getCoverName(), readResourceToByteArray("/" + cover.getImgUrl(), servletContext)); } // Load needed fonts medulaOneRegularFont = Font.createFont(Font.TRUETYPE_FONT, servletContext.getResourceAsStream("/Olhie/font/MedulaOne-Regular.ttf")); medulaOneRegularFont48 = medulaOneRegularFont.deriveFont(new Float(48.0)); arialBoldFont13 = new Font("Arial Bold", Font.BOLD, 13); arialBoldFont16 = new Font("Arial Bold", Font.ITALIC, 16); // Init font maps // author authorFontMap = new Hashtable<TextAttribute, Object>(); authorFontMap.put(TextAttribute.FONT, arialBoldFont16); authorFontMap.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); // Title titleFontMap = new Hashtable<TextAttribute, Object>(); titleFontMap.put(TextAttribute.FONT, medulaOneRegularFont48); titleFontMap.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); // Back cover title backTitleFontMap = new Hashtable<TextAttribute, Object>(); backTitleFontMap.put(TextAttribute.FONT, arialBoldFont13); backTitleFontMap.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); backTitleFontMap.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_ONE_PIXEL); // Build palette factory palFac = new PaletteFactory(); } catch (Exception e) { log.log(Level.SEVERE, "Error occured during BookCoverImageService initialization.", e); } }
From source file:cz.nn.copytables.gui.CopyTablesGUI.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Rudolf Rada ResourceBundle bundle = ResourceBundle.getBundle("locale"); menuBar = new JMenuBar(); menuFile = new JMenu(); menuItemOpenFile = new JMenuItem(); menuItemCloseFile = new JMenuItem(); menuItemConfig = new JMenuItem(); menuHelp = new JMenu(); menuItemHelp = new JMenuItem(); menuItemAbout = new JMenuItem(); CellConstraints cc = new CellConstraints(); //======== this ======== setBackground(new Color(204, 255, 204)); // JFormDesigner evaluation mark setBorder(/* w w w . j a va 2 s . c o m*/ new javax.swing.border.CompoundBorder( new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0), "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red), getBorder())); addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if ("border".equals(e.getPropertyName())) throw new RuntimeException(); } }); setLayout(new FormLayout("default", "default, $lgap, default")); //======== menuBar ======== { //======== menuFile ======== { menuFile.setText(bundle.getString("CopyTablesGUI.menuFile.text")); //---- menuItemOpenFile ---- menuItemOpenFile.setText(bundle.getString("CopyTablesGUI.menuItemOpenFile.text")); menuItemOpenFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { menuItem2ActionPerformed(e); } }); menuFile.add(menuItemOpenFile); //---- menuItemCloseFile ---- menuItemCloseFile.setText(bundle.getString("CopyTablesGUI.menuItemCloseFile.text")); menuItemCloseFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { menuItem3ActionPerformed(e); } }); menuFile.add(menuItemCloseFile); //---- menuItemConfig ---- menuItemConfig.setText(bundle.getString("CopyTablesGUI.menuItemConfig.text")); menuItemConfig.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { menuItem4ActionPerformed(e); } }); menuFile.add(menuItemConfig); } menuBar.add(menuFile); //======== menuHelp ======== { menuHelp.setText(bundle.getString("CopyTablesGUI.menuHelp.text")); //---- menuItemHelp ---- menuItemHelp.setText(bundle.getString("CopyTablesGUI.menuItemHelp.text")); menuItemHelp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { menuItemHelpActionPerformed(e); } }); menuHelp.add(menuItemHelp); //---- menuItemAbout ---- menuItemAbout.setText(bundle.getString("CopyTablesGUI.menuItemAbout.text")); menuItemAbout.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { menuItemAboutActionPerformed(e); } }); menuHelp.add(menuItemAbout); } menuBar.add(menuHelp); } add(menuBar, cc.xy(1, 1)); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:charts.PieChart3D.java
/** * Creates a chart.//w w w.j a v a 2 s . c o m * * @param dataset * the dataset. * * @return A chart. */ private static JFreeChart createChart(PieDataset dataset, PieChartModel model) { JFreeChart chart = ChartFactory.createPieChart(model.getTitle(), // 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("FCA", createGradientPaint(new Color(200, 200, 255), Color.BLUE)); plot.setSectionPaint("FCH", createGradientPaint(new Color(255, 200, 200), Color.RED)); plot.setSectionPaint("FCS", createGradientPaint(new Color(200, 255, 200), Color.GREEN)); plot.setSectionPaint("FCG", createGradientPaint(new Color(200, 255, 200), Color.YELLOW)); plot.setSectionPaint("FCJ", createGradientPaint(new Color(200, 255, 200), Color.BLACK)); plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} {1} ({2}) ")); 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(model.getSubTitle(), new Font("Courier New", Font.PLAIN, 12)); source.setPaint(Color.WHITE); source.setPosition(RectangleEdge.BOTTOM); source.setHorizontalAlignment(HorizontalAlignment.RIGHT); chart.addSubtitle(source); return chart; }
From source file:com.clank.launcher.dialog.LauncherFrame.java
private void initComponents() { webView = WebpagePanel.forURL(launcher.getNewsURL(), false); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, instanceScroll, webView); selfUpdateButton.setVisible(false);/*from w w w.j a v a 2s .c om*/ updateCheck.setSelected(true); instancesTable.setModel(instancesModel); launchButton.setFont(launchButton.getFont().deriveFont(Font.BOLD)); splitPane.setDividerLocation(200); splitPane.setDividerSize(4); SwingHelper.flattenJSplitPane(splitPane); buttonsPanel.addElement(refreshButton); buttonsPanel.addElement(updateCheck); buttonsPanel.addGlue(); buttonsPanel.addElement(selfUpdateButton); buttonsPanel.addElement(optionsButton); buttonsPanel.addElement(launchButton); container.setLayout(new BorderLayout()); container.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); container.add(splitPane, BorderLayout.CENTER); add(buttonsPanel, BorderLayout.SOUTH); add(container, BorderLayout.CENTER); instancesModel.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { if (instancesTable.getRowCount() > 0) { instancesTable.setRowSelectionInterval(0, 0); } } }); instancesTable.addMouseListener(new DoubleClickToButtonAdapter(launchButton)); refreshButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { loadInstances(); checkLauncherUpdate(); } }); selfUpdateButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { selfUpdate(); } }); optionsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showOptions(); } }); launchButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { launch(); } }); instancesTable.addMouseListener(new PopupMouseAdapter() { @Override protected void showPopup(MouseEvent e) { int index = instancesTable.rowAtPoint(e.getPoint()); Instance selected = null; if (index >= 0) { instancesTable.setRowSelectionInterval(index, index); selected = launcher.getInstances().get(index); } popupInstanceMenu(e.getComponent(), e.getX(), e.getY(), selected); } }); }
From source file:Text2DTest.java
public BranchGroup createSceneGraph() { // Create the root of the branch graph BranchGroup objRoot = new BranchGroup(); // Create a Transformgroup to scale all objects so they // appear in the scene. TransformGroup objScale = new TransformGroup(); Transform3D t3d = new Transform3D(); t3d.setScale(0.4);/*from w w w .j av a2 s . co m*/ objScale.setTransform(t3d); objRoot.addChild(objScale); // Create the transform group node and initialize it to the // identity. Enable the TRANSFORM_WRITE capability so that // our behavior code can modify it at runtime. Add it to the // root of the subgraph. TransformGroup objTrans = new TransformGroup(); objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0); TransformGroup textTranslationGroup; Transform3D textTranslation; float yPos = -.5f; Shape3D textObject = new Text2D("Rotating Yellow Text", new Color3f(1f, 1f, 0f), "Serif", 60, Font.BOLD); Appearance app = textObject.getAppearance(); PolygonAttributes pa = app.getPolygonAttributes(); if (pa == null) pa = new PolygonAttributes(); pa.setCullFace(PolygonAttributes.CULL_NONE); if (app.getPolygonAttributes() == null) app.setPolygonAttributes(pa); objTrans.addChild(textObject); textTranslation = new Transform3D(); textTranslation.setTranslation(new Vector3f(0f, yPos, 0f)); textTranslationGroup = new TransformGroup(textTranslation); textTranslationGroup.addChild(objTrans); objScale.addChild(textTranslationGroup); yPos += .5f; /* Blue 40point text */ textObject = new Text2D("Blue 40point Text", new Color3f(0f, 0f, 1f), "Serif", 40, Font.BOLD); textTranslation = new Transform3D(); textTranslation.setTranslation(new Vector3f(0f, yPos, 0f)); textTranslationGroup = new TransformGroup(textTranslation); textTranslationGroup.addChild(textObject); objScale.addChild(textTranslationGroup); yPos += .5f; /* Green italic text */ textObject = new Text2D("Green Italic Text", new Color3f(0f, 1f, 0f), "Serif", 70, Font.ITALIC); textTranslation = new Transform3D(); textTranslation.setTranslation(new Vector3f(0f, yPos, 0f)); textTranslationGroup = new TransformGroup(textTranslation); textTranslationGroup.addChild(textObject); objScale.addChild(textTranslationGroup); yPos += .5f; // Create a new Behavior object that will perform the desired // operation on the specified transform object and add it into // the scene graph. Transform3D yAxis = new Transform3D(); Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0, 4000, 0, 0, 0, 0, 0); RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objTrans, yAxis, 0.0f, (float) Math.PI * 2.0f); rotator.setSchedulingBounds(bounds); objTrans.addChild(rotator); return objRoot; }
From source file:playground.anhorni.counts.StdDevBoxPlot.java
public JFreeChart createChart() { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); ArrayList<Double>[] lists = this.createArrayLists(); // add the collected values to the graph / dataset for (int i = 0; i < 24; i++) { dataset.add(lists[i], "hour", Integer.toString(i + 1)); }/*from w w w .j a va2s .c o m*/ final CategoryAxis xAxis = new CategoryAxis(xlabel); xAxis.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 10)); //xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); final NumberAxis yAxis = new NumberAxis(ylabel); yAxis.setAutoRangeIncludesZero(true); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false); renderer.setSeriesPaint(0, Color.blue); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); this.chart_ = new JFreeChart(chartTitle, new Font("SansSerif", Font.BOLD, 14), plot, false); return this.chart_; }
From source file:net.pms.movieinfo.MovieInfo.java
@Override public JComponent config() { FormLayout layout = new FormLayout( "left:pref, 2dlu, p,2dlu, p,2dlu, p, 2dlu, p, 2dlu, p,2dlu, p,200dlu, pref:grow", //$NON-NLS-1$ "p, 5dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p,0:grow"); //$NON-NLS-1$ PanelBuilder builder = new PanelBuilder(layout); builder.border(Borders.EMPTY);// w w w . j av a2 s.c om builder.opaque(false); CellConstraints cc = new CellConstraints(); JComponent cmp = builder.addSeparator("MOVIE INFO CONFIG", cc.xy(1, 1)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); pluginsField = new JTextField(); pluginsField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented if (configuration.getPlugins() != null) pluginsField.setText(configuration.getPlugins()); pluginsField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { configuration.setPlugins(pluginsField.getText()); } }); builder.addLabel("Plugins to use (in prioritized order):", cc.xy(1, 3)); builder.add(pluginsField, cc.xyw(3, 3, 12)); maxNumberOfActorsField = new JSpinner(new SpinnerNumberModel()); maxNumberOfActorsField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented maxNumberOfActorsField.setValue(configuration.getMaxNumberOfActors()); maxNumberOfActorsField.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { configuration.setMaxNumberOfActors((Integer) maxNumberOfActorsField.getValue()); } }); builder.addLabel("Maximum number of actors to display:", cc.xy(1, 5)); builder.add(maxNumberOfActorsField, cc.xy(3, 5)); downloadCoverField = new JCheckBox(); downloadCoverField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented downloadCoverField.setSelected(configuration.getDownloadCover()); downloadCoverField.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { configuration.setDownloadCover(downloadCoverField.isSelected()); } }); builder.addLabel("Download cover to movie folder:", cc.xy(5, 5)); builder.add(downloadCoverField, cc.xy(7, 5)); displayInfoField = new JTextField(); displayInfoField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented if (configuration.getDisplayInfo() != null) { displayInfoField.setText(configuration.getDisplayInfoAsString()); } displayInfoField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //TODO: Needs verification logics configuration.setDisplayInfoFromString(displayInfoField.getText()); } }); builder.addLabel("DisplayInfo:", cc.xy(13, 5)); builder.add(displayInfoField, cc.xyw(14, 5, 2)); plotLineLengthField = new JSpinner(new SpinnerNumberModel()); plotLineLengthField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented plotLineLengthField.setValue(configuration.getPlotLineLength()); plotLineLengthField.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { configuration.setPlotLineLength((Integer) plotLineLengthField.getValue()); } }); builder.addLabel("Plot line length:", cc.xy(9, 5)); builder.add(plotLineLengthField, cc.xy(11, 5)); filterField = new JTextField(); filterField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented if (configuration.getFilters() != null) { filterField.setText(configuration.getFiltersAsString()); } filterField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //TODO: Needs verification logics configuration.setFiltersFromString(filterField.getText()); } }); ScanPath = new JTextField(); builder.addLabel("Filter:", cc.xy(1, 7)); builder.add(filterField, cc.xyw(3, 7, 12)); builder.addLabel("Scan path:", cc.xy(1, 9)); builder.add(ScanPath, cc.xyw(3, 9, 12)); ScanPath.setText((String) PMS.getConfiguration().getCustomProperty("movieinfo.scan_path")); JButton scan = new JButton("Scan files"); scan.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (mdb != null) { if (!mdb.isScanLibraryRunning()) { int option = JOptionPane.showConfirmDialog(LooksFrame.get(), Messages.getString("FoldTab.3") + Messages.getString("FoldTab.4"), Messages.getString("Dialog.Question"), JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { mdb.scanLibrary(ScanPath.getText()); } } else { int option = JOptionPane.showConfirmDialog(LooksFrame.get(), Messages.getString("FoldTab.10"), Messages.getString("Dialog.Question"), JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { mdb.stopScanLibrary(); } } } } }); builder.add(scan, cc.xy(1, 11)); return builder.getPanel(); }
From source file:net.sf.dynamicreports.test.jasper.chart.XyStepChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);//from w w w . j a v a 2s. co m JFreeChart chart = getChart("summary.chart1", 0); XYItemRenderer renderer = chart.getXYPlot().getRenderer(); Assert.assertEquals("renderer", XYStepRenderer.class, renderer.getClass()); Assert.assertEquals("step point", 0.5d, ((XYStepRenderer) renderer).getStepPoint()); chart = getChart("summary.chart2", 0); Axis axis = chart.getXYPlot().getDomainAxis(); Assert.assertEquals("category label", "category", axis.getLabel()); Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); chart = getChart("summary.chart3", 0); axis = chart.getXYPlot().getRangeAxis(); Assert.assertEquals("value label", "value", axis.getLabel()); Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10)); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound()); Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound()); }
From source file:RMOS.PieChart.java
/** * Creates a chart.//from w w w. j a v a 2 s . c o m * * @param dataset the dataset. * * @return A chart. */ private static JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Eco Systems Statistics", // 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); plot.setSectionPaint(f1.getStationInGroup().get(1), Color.blue); plot.setSectionPaint(f1.getStationInGroup().get(1), Color.GREEN); // 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: Eco Recycle Station", new Font("Courier New", Font.PLAIN, 12)); source.setPaint(Color.WHITE); source.setPosition(RectangleEdge.BOTTOM); source.setHorizontalAlignment(HorizontalAlignment.RIGHT); chart.addSubtitle(source); return chart; }