Example usage for java.awt Font PLAIN

List of usage examples for java.awt Font PLAIN

Introduction

In this page you can find the example usage for java.awt Font PLAIN.

Prototype

int PLAIN

To view the source code for java.awt Font PLAIN.

Click Source Link

Document

The plain style constant.

Usage

From source file:it.eng.spagobi.engines.chart.bo.charttypes.linecharts.LineChart.java

public JFreeChart createChart() {

    logger.debug("IN");
    CategoryPlot plot = new CategoryPlot();

    NumberAxis rangeAxis = new NumberAxis("Kpi Values");
    rangeAxis.setLabelFont(new Font("Arial", Font.PLAIN, 12));
    Color colorLabel = Color.decode("#000000");
    rangeAxis.setLabelPaint(colorLabel);
    rangeAxis.setTickLabelFont(new Font("Arial", Font.PLAIN, 10));
    rangeAxis.setTickLabelPaint(colorLabel);
    plot.setRangeAxis(rangeAxis);/*from   w  w w  .  j a  v  a  2  s . co m*/

    CategoryAxis domainAxis = new CategoryAxis();
    domainAxis.setLabelFont(new Font("Arial", Font.PLAIN, 10));
    domainAxis.setLabelPaint(colorLabel);
    domainAxis.setTickLabelFont(new Font("Arial", Font.PLAIN, 10));
    domainAxis.setTickLabelPaint(colorLabel);
    plot.setDomainAxis(domainAxis);

    plot.setOrientation(PlotOrientation.VERTICAL);
    plot.setRangeGridlinesVisible(true);
    plot.setDomainGridlinesVisible(true);

    //I create a line renderer 
    MyStandardCategoryItemLabelGenerator generator = null;

    LineAndShapeRenderer lineRenderer = new LineAndShapeRenderer();
    lineRenderer.setShapesFilled(true);
    lineRenderer.setBaseItemLabelGenerator(generator);
    lineRenderer.setBaseItemLabelFont(new Font("Arial", Font.PLAIN, 12));
    lineRenderer.setBaseItemLabelPaint(colorLabel);
    lineRenderer.setBaseItemLabelsVisible(true);

    DefaultCategoryDataset datasetLine = (DefaultCategoryDataset) datasetMap.getDatasets().get("line");

    for (Iterator iterator = datasetLine.getRowKeys().iterator(); iterator.hasNext();) {
        String serName = (String) iterator.next();
        String labelName = "";
        int index = -1;
        index = datasetLine.getRowIndex(serName);

        Color color = Color.decode("#990200");
        lineRenderer.setSeriesPaint(index, color);
    }

    plot.setDataset(0, datasetLine);
    plot.setRenderer(0, lineRenderer);

    plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    JFreeChart chart = new JFreeChart(plot);
    logger.debug("Chart created");
    TextTitle title = new TextTitle(name, new Font("Arial", Font.BOLD, 16), Color.decode("#990200"),
            RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.TOP, RectangleInsets.ZERO_INSETS);
    chart.setTitle(title);
    TextTitle subTitle = new TextTitle(subName, new Font("Arial", Font.PLAIN, 12), Color.decode("#000000"),
            RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.TOP, RectangleInsets.ZERO_INSETS);
    chart.addSubtitle(subTitle);
    TextTitle subTitle2 = new TextTitle(subName, new Font("Arial", Font.PLAIN, 8), Color.decode("#FFFFFF"),
            RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.TOP, RectangleInsets.ZERO_INSETS);
    chart.addSubtitle(subTitle2);
    chart.removeLegend();

    chart.setBackgroundPaint(Color.white);
    logger.debug("OUT");
    return chart;
}

From source file:org.matsim.counts.algorithms.graphs.BoxPlotErrorGraph.java

@SuppressWarnings("unchecked")
@Override/*  w  w  w .j a va2s. c  om*/
public JFreeChart createChart(final int nbr) {

    DefaultBoxAndWhiskerCategoryDataset dataset0 = new DefaultBoxAndWhiskerCategoryDataset();
    DefaultBoxAndWhiskerCategoryDataset dataset1 = new DefaultBoxAndWhiskerCategoryDataset();

    final ArrayList<Double>[] listRel = new ArrayList[24];
    final ArrayList<Double>[] listAbs = new ArrayList[24];

    // init
    for (int i = 0; i < 24; i++) {
        listRel[i] = new ArrayList<Double>();
        listAbs[i] = new ArrayList<Double>();
    }

    // add the values of all counting stations to each hour
    for (CountSimComparison cc : this.ccl_) {
        int hour = cc.getHour() - 1;
        listRel[hour].add(cc.calculateRelativeError());
        listAbs[hour].add(cc.getSimulationValue() - cc.getCountValue());
    }

    // add the collected values to the graph / dataset
    for (int i = 0; i < 24; i++) {
        dataset0.add(listRel[i], "Rel Error", Integer.toString(i + 1));
        dataset1.add(listAbs[i], "Abs Error", Integer.toString(i + 1));
    }

    String title = "Iteration: " + this.iteration_;

    final CombinedDomainCategoryPlot plot = new CombinedDomainCategoryPlot();

    final CategoryAxis xAxis = new CategoryAxis("Hour");
    final NumberAxis yAxis0 = new NumberAxis("Signed Rel. Error [%]");
    final NumberAxis yAxis1 = new NumberAxis("Signed Abs. Error [veh]");
    yAxis0.setAutoRangeIncludesZero(false);
    yAxis1.setAutoRangeIncludesZero(false);

    final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
    renderer.setFillBox(false);
    renderer.setSeriesPaint(0, Color.blue);
    renderer.setSeriesToolTipGenerator(0, new BoxAndWhiskerToolTipGenerator());

    CategoryPlot subplot0 = new CategoryPlot(dataset0, xAxis, yAxis0, renderer);
    CategoryPlot subplot1 = new CategoryPlot(dataset1, xAxis, yAxis1, renderer);

    plot.add(subplot0);
    plot.add(subplot1);

    final CategoryAxis axis1 = new CategoryAxis("hour");
    axis1.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 7));
    axis1.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    plot.setDomainAxis(axis1);

    this.chart_ = new JFreeChart(title, new Font("SansSerif", Font.BOLD, 14), plot, false);
    return this.chart_;
}

From source file:com.jcraft.weirdx.DDXFont.java

public Font getFont() {
    if (font != null)
        return font;
    int size = 12;
    try {/*ww  w . j ava 2s . com*/
        int tmp = Integer.parseInt(getFontSize());
        if (tmp != 0) {
            size = tmp;
        }
    } catch (Exception e) {
        LOG.error(e);
    }

    int style = Font.PLAIN;
    if (getWeight().equals("bold"))
        style |= Font.BOLD;
    if (getStyle().equals("i"))
        style |= Font.ITALIC;
    if (getFamily().equals("times") || getFamily().equals("times new roman")
            || getFamily().equals("new century schoolbook")) {
        font = getFont("Serif", style, size);
    } else if (getFamily().equals("helvetica") || getFamily().equals("helvetic")
            || getFamily().equals("courier")) {
        font = getFont("SansSerif", style, size);
    } else {
        font = getFont("Monospaced", style, size);
    }

    metric = java.awt.Toolkit.getDefaultToolkit().getFontMetrics(font);

    String reg = getCharsetRegistry();
    String enc = getCharsetEncoding();

    for (Font_CharSet foo : XFont.charSets) {
        if (reg.equals(foo.getCharset()) || enc.equals(foo.getCharset())) {
            min_byte1 = foo.getMinByte1();
            max_byte1 = foo.getMaxByte1();
            min_char_or_byte2 = foo.getMinCharOrByte2();
            max_char_or_byte2 = foo.getMaxCharOrByte2();
            default_char = foo.getDefaultChar();
            encoding = foo.getEncoding();
            charset = foo;
            break;
        }
    }

    min_width = getMaxAdvance();
    max_width = getMaxAdvance();

    if (encoding != null) {
        int tmp = default_char;
        int i = 0;
        while (tmp != 0) {
            i++;
            tmp >>= 8;
            tmp &= 0xffffff;
        }
        byte[] btmp = new byte[i];
        tmp = default_char;
        i--;
        while (tmp != 0) {
            btmp[i] = (byte) (tmp & 0xff);
            tmp >>= 8;
            tmp &= 0xffffff;
            i--;
        }
        char[] ctmp = new char[1];
        if (charset != null)
            charset.encode(btmp, 0, btmp.length, ctmp);
        max_width = min_width = metric.charWidth(ctmp[0]);
        if (getSpace().equals("p")) {
            min_width = 0;
        }
    } else {
        char[] ctmp = new char[1];
        ctmp[0] = '@';
        max_width = metric.charsWidth(ctmp, 0, 1);
        ctmp[0] = ' ';
        min_width = metric.charsWidth(ctmp, 0, 1);
    }
    return font;
}

From source file:edu.harvard.i2b2.query.ui.MainPanel.java

/** Creates new form QueryTopPanel */
public MainPanel(QueryToolPanel parent) {
    parentPanel = parent;/*from   w w  w.  ja v a  2s  .  c o  m*/
    dataModel = parent.dataModel();

    UIManager.put("Label.font", new Font("Tahoma", Font.PLAIN, 11));

    UIManager.put("Button.font", new Font("Tahoma", Font.PLAIN, 11));

    UIManager.put("TextField.font", new Font("Tahoma", Font.PLAIN, 11));

    UIManager.put("CheckBox.font", new Font("Tahoma", Font.PLAIN, 11));

    UIManager.put("RadioButton.font", new Font("Tahoma", Font.PLAIN, 11));

    UIManager.put("Tree.font", new Font("Tahoma", Font.PLAIN, 11));

    UIManager.put("ComboBox.font", new Font("Tahoma", Font.PLAIN, 11));

    initComponents();
    // jGetPatientCountCheckBox.setSelected(true);
    // jShowTimelineCheckBox.setSelected(true);

    addComponentListener(new java.awt.event.ComponentAdapter() {
        @Override
        public void componentMoved(java.awt.event.ComponentEvent evt) {
            // formComponentMoved(evt);
        }

        @Override
        public void componentResized(java.awt.event.ComponentEvent evt) {
            // formComponentResized(evt);
            // System.out.println("waiting panel resizing ...");
            int width = (getParent().getWidth());
            int height = (getParent().getHeight());
            if (width < 5 || height < 5) {
                return;
            }

            resizePanels(width, height);
            // log.info("width: "+width+", height: "+height);

            if (firsttime) {
                firsttime = false;
                resizePanels(width, height + 3);
                // log.info("second width: "+width+", height: "+(height+3));
            }
        }
    });
}

From source file:com.bdb.weather.display.current.Barometer.java

private ChartViewer createChartElements(Pressure min, Pressure max) {
    Color backgroundDialColor = StageUtilities
            .toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_DIAL_COLOR));
    Paint backgroundPaint = new GradientPaint(0.0f, 0.0f, Color.LIGHT_GRAY, 100.0f, 0.0f, backgroundDialColor);
    DialBackground background = new DialBackground(backgroundPaint);
    plot.addLayer(background);//from w w w  .jav  a  2s .c om
    double dialTickIncrements = .2;
    switch (Pressure.getDefaultUnit()) {
    case IN_HG:
        dialTickIncrements = .2;
        break;
    case HECTO_PASCAL:
    case MILLIBAR:
        dialTickIncrements = 10.0;
        break;
    }

    scale = new StandardDialScale(min.get(), max.get(), 240.0, -300.0, dialTickIncrements, 10);
    scale.setTickLabelFont(scale.getTickLabelFont().deriveFont(14.0F).deriveFont(Font.PLAIN));
    scale.setTickRadius(.9);
    scale.setTickLabelFormatter(Pressure.getDefaultFormatter());
    scale.setTickLabelOffset(.25);
    scale.setTickLabelPaint(
            StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_SCALE_TEXT)));
    scale.setMajorTickPaint(
            StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_SCALE_TICK)));
    scale.setMinorTickPaint(
            StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_SCALE_TICK)));
    plot.addScale(0, scale);
    plot.setDialFrame(new StandardDialFrame());
    DialValueIndicator valueInd = new DialValueIndicator(0);
    //
    // Set background and outline paint to be completely transparent so they do not show at all
    //
    valueInd.setBackgroundPaint(new Color(255, 255, 255, 0));
    valueInd.setOutlinePaint(new Color(255, 255, 255, 0));
    valueInd.setPaint(StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_VALUE)));
    valueInd.setNumberFormat(Pressure.getDefaultUnit().getFormatterWithUnit());
    plot.addLayer(valueInd);

    double angle = valueInd.getAngle();
    double radius = valueInd.getRadius();

    trendAnnotation.setPaint(StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_VALUE)));
    trendAnnotation.setAngle(angle);
    trendAnnotation.setRadius(radius + .1);
    plot.addLayer(trendAnnotation);

    DialPointer.Pointer pointer = new DialPointer.Pointer(0);
    plot.addPointer(pointer);

    DialCap cap = new DialCap();
    cap.setRadius(cap.getRadius() * 1.5);
    plot.setCap(cap);

    range = new StandardDialRange(0.0, 360.0,
            StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_VALUE_RANGE)));
    range.setInnerRadius(.40);
    range.setOuterRadius(.45);
    range.setScaleIndex(0);
    plot.addLayer(range);

    JFreeChart chart = new JFreeChart(plot);
    chart.setBackgroundPaint(
            StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_BACKGROUND)));

    ChartViewer chartViewer = new ChartViewer(chart);
    chartViewer.setMinHeight(200);
    chartViewer.setMinWidth(200);
    chartViewer.setMaxHeight(10000);
    chartViewer.setMaxWidth(10000);

    //chartViewer.setBorder(new BevelBorder(BevelBorder.RAISED));

    return chartViewer;
}

From source file:Interface.ResultadoJanela.java

public JFreeChart gerarGrafico(CategoryDataset dataSet) {
    JFreeChart chart = ChartFactory.createBarChart3D("Resultado da Localizao de Defeitos", //Titulo
            " ", // Eixo X
            "Probabilidade (%)", //Eixo Y
            dataSet, // Dados para o grafico
            PlotOrientation.VERTICAL, //Orientacao do grafico
            true, true, true); // exibir: legendas, tooltips, url
    chart.setBackgroundPaint(Color.getHSBColor(0, 0, (float) 0.835)); // Set the background colour of the chart

    CategoryPlot p = chart.getCategoryPlot(); // Get the Plot object for a bar graph
    p.setBackgroundPaint(Color.white); // Modify the plot background 
    p.setRangeGridlinePaint(Color.BLACK);

    CategoryAxis axis = p.getDomainAxis();
    axis.setTickLabelFont(new Font("Helvetica", Font.PLAIN, 10));
    axis.setMaximumCategoryLabelWidthRatio(1.0f);
    axis.setMaximumCategoryLabelLines(2);
    p.setDomainAxis(axis);/*  w w  w  .  j a va  2s  .c  om*/

    return chart;
}

From source file:org.matsim.counts.algorithms.graphs.BoxPlotNormalizedErrorGraph.java

@SuppressWarnings("unchecked")
@Override//from  ww  w.  j a  v a 2s  . c om
public JFreeChart createChart(final int nbr) {

    DefaultBoxAndWhiskerCategoryDataset dataset0 = new DefaultBoxAndWhiskerCategoryDataset();
    DefaultBoxAndWhiskerCategoryDataset dataset1 = new DefaultBoxAndWhiskerCategoryDataset();

    final ArrayList<Double>[] listRel = new ArrayList[24];
    final ArrayList<Double>[] listAbs = new ArrayList[24];

    // init
    for (int i = 0; i < 24; i++) {
        listRel[i] = new ArrayList<Double>();
        listAbs[i] = new ArrayList<Double>();
    }

    // add the values of all counting stations to each hour
    for (CountSimComparison cc : this.ccl_) {
        int hour = cc.getHour() - 1;
        listRel[hour].add(cc.calculateNormalizedRelativeError() * 100);
        listAbs[hour].add(cc.getSimulationValue() - cc.getCountValue());
    }

    // add the collected values to the graph / dataset
    for (int i = 0; i < 24; i++) {
        dataset0.add(listRel[i], "Rel Norm Error", Integer.toString(i + 1));
        dataset1.add(listAbs[i], "Abs Error", Integer.toString(i + 1));
    }

    String title = "Iteration: " + this.iteration_;

    final CombinedDomainCategoryPlot plot = new CombinedDomainCategoryPlot();

    final CategoryAxis xAxis = new CategoryAxis("Hour");
    final NumberAxis yAxis0 = new NumberAxis("Norm. Rel. Error [%]");
    final NumberAxis yAxis1 = new NumberAxis("Signed Abs. Error [veh]");
    yAxis0.setAutoRangeIncludesZero(false);
    yAxis1.setAutoRangeIncludesZero(false);

    final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
    renderer.setFillBox(false);
    renderer.setSeriesPaint(0, Color.blue);
    renderer.setSeriesToolTipGenerator(0, new BoxAndWhiskerToolTipGenerator());

    CategoryPlot subplot0 = new CategoryPlot(dataset0, xAxis, yAxis0, renderer);
    CategoryPlot subplot1 = new CategoryPlot(dataset1, xAxis, yAxis1, renderer);

    plot.add(subplot0);
    plot.add(subplot1);

    final CategoryAxis axis1 = new CategoryAxis("hour");
    axis1.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 7));
    axis1.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    plot.setDomainAxis(axis1);

    this.chart_ = new JFreeChart(title, new Font("SansSerif", Font.BOLD, 14), plot, false);
    return this.chart_;
}

From source file:ascensionxyplot.AscensionXYPlot.java

/**
 * Creates a combined chart.//from  w  ww.j  a v  a 2s  . com
 *
 * @return The combined chart.
 */
private JFreeChart createCombinedChart(File dataFile) {

    // create subplot 1...
    final XYDataset data1 = createDataset1(dataFile);
    final XYItemRenderer renderer1 = new StandardXYItemRenderer();
    final NumberAxis rangeAxis1 = new NumberAxis("Range 1");
    final XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
    subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    // add secondary axis
    //        subplot1.setDataset(1, createDataset2());
    //        final NumberAxis axis2 = new NumberAxis("Range Axis 2");
    //        axis2.setAutoRangeIncludesZero(false);
    //        subplot1.setRangeAxis(1, axis2);
    //        subplot1.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);
    //        subplot1.setRenderer(1, new StandardXYItemRenderer());       
    //        subplot1.mapDatasetToRangeAxis(1, 1);

    final XYTextAnnotation annotation1 = new XYTextAnnotation("x value", 20.0, 120000.0);
    final XYTextAnnotation annotation2 = new XYTextAnnotation("y value", 20.0, 110000.0);
    final XYTextAnnotation annotation3 = new XYTextAnnotation("z value", 20.0, 100000.0);
    final XYTextAnnotation annotation4 = new XYTextAnnotation("timepoint", 20.0, 10000.0);
    annotation1.setFont(new Font("SansSerif", Font.PLAIN, 9));
    annotation2.setFont(new Font("SansSerif", Font.PLAIN, 9));
    annotation3.setFont(new Font("SansSerif", Font.PLAIN, 9));
    annotation4.setFont(new Font("SansSerif", Font.PLAIN, 9));
    //        annotation.setRotationAngle(Math.PI / 4.0);
    subplot1.addAnnotation(annotation1);
    subplot1.addAnnotation(annotation2);
    subplot1.addAnnotation(annotation3);
    subplot1.addAnnotation(annotation4);

    // create subplot 2...
    final XYDataset data2 = createDataset2();
    final XYItemRenderer renderer2 = new StandardXYItemRenderer();
    final NumberAxis rangeAxis2 = new NumberAxis("Range 2");
    rangeAxis2.setAutoRangeIncludesZero(false);
    final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
    subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);

    // parent plot...
    final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain"));
    plot.setGap(10.0);

    // add the subplots...
    plot.add(subplot1, 1);
    plot.add(subplot2, 1);
    plot.setOrientation(PlotOrientation.VERTICAL);

    // return a new chart containing the overlaid plot...
    return new JFreeChart("Is this the title?", JFreeChart.DEFAULT_TITLE_FONT, plot, true);

}

From source file:Text3DLoad.java

public BranchGroup createSceneGraph() {
    float sl = textString.length();
    // 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();
    // Assuming uniform size chars, set scale to fit string in view
    t3d.setScale(1.2 / sl);// www .  j  av a 2 s . c o  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);
    objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
    objScale.addChild(objTrans);

    Font3D f3d;
    if (tessellation > 0.0) {
        f3d = new Font3D(new Font(fontName, Font.PLAIN, 2), tessellation, new FontExtrusion());
    } else {
        f3d = new Font3D(new Font(fontName, Font.PLAIN, 2), new FontExtrusion());
    }
    Text3D txt = new Text3D(f3d, textString, new Point3f(-sl / 2.0f, -1.f, -1.f));
    Shape3D sh = new Shape3D();
    Appearance app = new Appearance();
    Material mm = new Material();
    mm.setLightingEnable(true);
    app.setMaterial(mm);
    sh.setGeometry(txt);
    sh.setAppearance(app);
    objTrans.addChild(sh);

    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);

    if (false) {
        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);
    }

    // Set up the background
    Color3f bgColor = new Color3f(0.05f, 0.05f, 0.5f);
    Background bgNode = new Background(bgColor);
    bgNode.setApplicationBounds(bounds);
    objRoot.addChild(bgNode);

    // Set up the ambient light
    Color3f ambientColor = new Color3f(0.3f, 0.3f, 0.3f);
    AmbientLight ambientLightNode = new AmbientLight(ambientColor);
    ambientLightNode.setInfluencingBounds(bounds);
    objRoot.addChild(ambientLightNode);

    // Set up the directional lights
    Color3f light1Color = new Color3f(1.0f, 1.0f, 0.9f);
    Vector3f light1Direction = new Vector3f(1.0f, 1.0f, 1.0f);
    Color3f light2Color = new Color3f(1.0f, 1.0f, 0.9f);
    Vector3f light2Direction = new Vector3f(-1.0f, -1.0f, -1.0f);

    DirectionalLight light1 = new DirectionalLight(light1Color, light1Direction);
    light1.setInfluencingBounds(bounds);
    objRoot.addChild(light1);

    DirectionalLight light2 = new DirectionalLight(light2Color, light2Direction);
    light2.setInfluencingBounds(bounds);
    objRoot.addChild(light2);

    return objRoot;
}

From source file:UserInterface.PublisherRole.ViewUserHabitsJPanel.java

private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart("User Habits", // chart title
            dataset, // data
            false, // no legend
            true, // tooltips
            false // no URL generation
    );/* www  . j a  v a 2  s. c  om*/

    // 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(" ", new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    return chart;

}