Example usage for java.awt Font BOLD

List of usage examples for java.awt Font BOLD

Introduction

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

Prototype

int BOLD

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

Click Source Link

Document

The bold style constant.

Usage

From source file:it.alus.GPSreceiver.instruments.Accelerometer.java

public Accelerometer() {
    super(null);//  w w w .  ja  v  a 2 s  .co  m
    dataset = new DefaultValueDataset(0.0);
    DialPlot plot = new DialPlot();
    plot.setView(0.0, 0.0, 1.0, 1.0);
    plot.setDataset(0, dataset);
    StandardDialFrame dialFrame = new StandardDialFrame();
    dialFrame.setBackgroundPaint(Color.lightGray);
    dialFrame.setForegroundPaint(Color.gray);
    DialTextAnnotation titleLabel = new DialTextAnnotation("Acceleration");
    titleLabel.setFont(new Font("Arial", 1, 18));
    titleLabel.setRadius(0.45D);
    titleLabel.setAngle(90);
    titleLabel.setPaint(Color.lightGray);
    plot.addLayer(titleLabel);
    DialValueIndicator valueindicator = new DialValueIndicator(0);
    plot.addLayer(valueindicator);
    DialTextAnnotation annotation = new DialTextAnnotation("g");
    annotation.setFont(new Font("Arial", 1, 20));
    annotation.setRadius(0.4D);
    annotation.setPaint(Color.lightGray);
    plot.addLayer(annotation);
    plot.setDialFrame(dialFrame);
    StandardDialScale scale = new StandardDialScale(-1, 3, -95, -340, 1, 20);
    scale.setMajorTickPaint(Color.white);
    scale.setMinorTickPaint(Color.lightGray);
    scale.setFirstTickLabelVisible(true);
    scale.setTickRadius(0.88);
    scale.setTickLabelOffset(0.15);
    NumberFormat formatter = new DecimalFormat("#");
    scale.setTickLabelFormatter(formatter);
    scale.setTickLabelFont(new Font("Arial", Font.BOLD, 24));
    scale.setTickLabelPaint(Color.white);
    plot.addScale(0, scale);
    plot.setBackground(new DialBackground(Color.black));
    Pointer needle = new Pointer(0);
    needle.setFillPaint(Color.white);
    plot.addLayer(needle);
    plot.mapDatasetToScale(1, 1);
    DialCap cap = new DialCap();
    cap.setRadius(0.10);
    cap.setFillPaint(Color.gray);
    plot.setCap(cap);
    jChart = new JFreeChart(plot);
    super.setChart(jChart);
    super.setPreferredSize(new Dimension(400, 400));
}

From source file:org.jfree.chart.demo.MeterChartDemo.java

/**
 * Displays a meter chart./*  w  ww  .j  a v  a 2s .  co  m*/
 *
 * @param value  the value.
 * @param shape  the dial shape.
 */
void displayMeterChart(final double value, final DialShape shape) {

    final DefaultValueDataset data = new DefaultValueDataset(75.0);
    final MeterPlot plot = new MeterPlot(data);
    plot.setUnits("Degrees");
    plot.setRange(new Range(20.0, 140.0));
    //        plot.setNormalRange(new Range(70.0, 100.0));
    //      plot.setWarningRange(new Range(100.0, 120.0));
    //    plot.setCriticalRange(new Range(120.0, 140.0));

    plot.setDialShape(shape);
    plot.setNeedlePaint(Color.white);
    plot.setTickLabelFont(new Font("SansSerif", Font.BOLD, 9));

    //  plot.setInsets(new Insets(5, 5, 5, 5));
    final JFreeChart chart = new JFreeChart("Meter Chart", JFreeChart.DEFAULT_TITLE_FONT, plot, false);

    //        final MeterLegend legend = new MeterLegend("Sample Meter");
    //      chart.setLegend(legend);

    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue));

    final JFrame chartFrame = new ChartFrame("Meter Chart", chart);
    chartFrame.addWindowListener(new WindowAdapter() {
        /**
         * Invoked when a window is in the process of being closed.
         * The close operation can be overridden at this point.
         */
        public void windowClosing(final WindowEvent e) {
            System.exit(0);
        }
    });
    chartFrame.pack();
    RefineryUtilities.positionFrameRandomly(chartFrame);
    chartFrame.setSize(250, 250);
    chartFrame.setVisible(true);

}

From source file:uom.research.thalassemia.util.PieChartCreator.java

/**
 * Creates a chart./*from   w  ww .ja  v a 2 s  . com*/
 *
 * @param dataset the dataset.
 *
 * @return A chart.
 */
private JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart(title, // chart title
            dataset, // data
            true, // 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
    int itemIndex = 0;
    for (Object col : pieDataset.getKeys()) {
        plot.setSectionPaint(col.toString(), gradientPaints[itemIndex]);
        if (itemIndex == pieDataset.getItemCount() - 1) {
            itemIndex = 0;
        }
        itemIndex++;
    }

    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: http://www.bbc.co.uk/news/business-15489523",
            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:edu.msu.cme.rdp.classifier.train.validation.distance.BoxPlotUtils.java

public static void createBoxplot(DefaultBoxAndWhiskerCategoryDataset scatterDataset, PrintStream outStream,
        String title, String xAxisLabel, String yAxisLabel, Font lableFont) throws IOException {

    CategoryAxis xAxis = new CategoryAxis(xAxisLabel);
    xAxis.setLabelFont(lableFont);/*from  www  .jav  a2s. c o m*/
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    yAxis.setTickLabelFont(lableFont);
    yAxis.setAutoRangeIncludesZero(false);
    yAxis.setRange(0, 100);
    yAxis.setLabelFont(lableFont);

    BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
    renderer.setFillBox(true);
    renderer.setBaseLegendTextFont(lableFont);
    renderer.setStroke(new BasicStroke(5.0f));

    CategoryPlot plot = new CategoryPlot(scatterDataset, xAxis, yAxis, renderer);
    JFreeChart boxchart = new JFreeChart(title, new Font("Helvetica", Font.BOLD, 40), plot, true);

    // higher scale factor gives higher resolution
    ChartUtilities.writeScaledChartAsPNG(outStream, boxchart, 800, 1000, 3, 3);
}

From source file:unalcol.termites.boxplots.ECALAgentsRight.java

/**
 * Creates a new demo.//from   w w  w  . jav  a 2 s  .c o m
 *
 * @param title the frame title.
 * @param pf
 */
public ECALAgentsRight(final String title, ArrayList<Double> pf) {

    super(title);

    final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(pf);

    final CategoryAxis xAxis = new CategoryAxis("");
    //        final NumberAxis yAxis = new NumberAxis("Round number");
    final NumberAxis yAxis = new NumberAxis("");

    yAxis.setAutoRangeIncludesZero(false);
    final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
    renderer.setFillBox(false);
    renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
    final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);

    Font font = new Font("Dialog", Font.PLAIN, 13);
    xAxis.setTickLabelFont(font);
    yAxis.setTickLabelFont(font);
    yAxis.setLabelFont(font);

    final JFreeChart chart = new JFreeChart("Agents Right " + getTitle(pf),
            new Font("SansSerif", Font.BOLD, 18), plot, true);

    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(650, 370));
    setContentPane(chartPanel);
    TextTitle legendText = null;
    if (pf.size() == 1) {
        legendText = new TextTitle("Population Size");
    } else {
        legendText = new TextTitle("Population Size - Probability of Failure");
    }

    legendText.setFont(font);
    legendText.setPosition(RectangleEdge.BOTTOM);
    chart.addSubtitle(legendText);
    chart.getLegend().setItemFont(font);

    FileOutputStream output;
    try {
        output = new FileOutputStream("ECALright" + pf + ".jpg");
        ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 400, 400, null);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(ECALAgentsRight.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(ECALAgentsRight.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:playground.anhorni.PLOC.analysis.MultipleEnsemblesBoxPlot.java

public JFreeChart createChart() {
    String title = chartTitle;/*from  w  ww .j  a v a  2s  . co m*/

    final CategoryAxis xAxis = new CategoryAxis("Runs ensemble size");
    xAxis.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 10));
    xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

    final NumberAxis yAxis = new NumberAxis("AvgDaysRuns_OfEnsembleAverageOfTotalExpenditures");
    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(title, new Font("SansSerif", Font.BOLD, 14), plot, false);
    return this.chart_;
}

From source file:de.fub.maps.project.detector.model.inference.ui.charts.ClassificationBarChart.java

/**
 * Creates new form ClassificationBarChart
 */// w  w  w  .j  a  va2  s  . c  o m
public ClassificationBarChart() {
    super();
    initComponents();
    plot = new CustomCategoryPlot();
    barChart = new JFreeChart(NbBundle.getMessage(ClassificationBarChart.class, "CLT_Chart_Classify_Name"),
            null, plot, true);
    ChartFactory.getChartTheme().apply(barChart);
    plot.setDomainAxis(new CategoryAxis());
    plot.getDomainAxis().setLabel(NbBundle.getMessage(ClassificationBarChart.class, "CLT_Doman_Axis_Name"));
    plot.setOrientation(PlotOrientation.VERTICAL);

    Font font = new JLabel().getFont().deriveFont(Font.BOLD, 14);
    barChart.getTitle().setFont(font);
    barChart.getTitle().setPaint(new Color(153, 153, 153));

    plot.setDataset(0, relDataset);
    plot.setDataset(1, absDataset);
    plot.mapDatasetToRangeAxis(0, 0);
    plot.mapDatasetToRangeAxis(1, 1);

    NumberAxis relAxis = new NumberAxis(
            NbBundle.getMessage(ClassificationBarChart.class, "CLT_Value_Axis_Name"));
    relAxis.setAutoRange(true);
    relAxis.setUpperMargin(.20);
    NumberAxis absAxis = new NumberAxis(
            NbBundle.getMessage(ClassificationBarChart.class, "CLT_Value_Rel_Axis_Name"));
    absAxis.setAutoRange(true);
    absAxis.setUpperMargin(.20);

    plot.setRangeAxis(0, relAxis);
    plot.setRangeAxis(1, absAxis);
    plot.setRangeAxisLocation(0, AxisLocation.TOP_OR_LEFT);
    plot.setRangeAxisLocation(1, AxisLocation.TOP_OR_RIGHT);

    BarRenderer relRenderer = new BarRenderer();
    relRenderer.setBasePaint(relColor);
    relRenderer.setAutoPopulateSeriesPaint(false);
    relRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    relRenderer.setBarPainter(new StandardBarPainter());
    relRenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(
            StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, new CustomNumberFormat()));
    relRenderer.setBaseItemLabelsVisible(true);

    BarRenderer absRenderer = new BarRenderer();
    absRenderer.setBasePaint(absColor);
    absRenderer.setAutoPopulateSeriesPaint(false);
    absRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    absRenderer.setBarPainter(new StandardBarPainter());
    absRenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(
            StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, new CustomNumberFormat()));
    absRenderer.setBaseItemLabelsVisible(true);

    plot.setRenderer(0, relRenderer);
    plot.setRenderer(1, absRenderer);

    plot.setBackgroundPaint(Color.white);
    barChart.setBackgroundPaint(Color.white);
    plot.setRangeGridlinesVisible(false);
    chartPanel = new ChartPanel(barChart, false);
    chartPanel.setVerticalAxisTrace(false);
    chartPanel.setDisplayToolTips(true);
    chartPanel.setBackground(Color.white);
    add(chartPanel, BorderLayout.CENTER);
}

From source file:com.tcz.api.config.captcha.CaptchaEngine.java

/**
 * ?/*from  w w w . ja  v  a 2s . c o m*/
 */
public void afterPropertiesSet() throws Exception {
    Assert.state(imageWidth > 0);
    Assert.state(imageHeight > 0);
    Assert.state(minFontSize > 0);
    Assert.state(maxFontSize > 0);
    Assert.state(minWordLength > 0);
    Assert.state(maxWordLength > 0);
    Assert.hasText(charString);

    Font[] fonts = new Font[] { new Font("Arial", Font.BOLD, maxFontSize),
            new Font("Bell", Font.BOLD, maxFontSize), new Font("Credit", Font.BOLD, maxFontSize),
            new Font("Impact", Font.BOLD, maxFontSize) };
    FontGenerator fontGenerator = new RandomFontGenerator(minFontSize, maxFontSize, fonts);
    BackgroundGenerator backgroundGenerator = StringUtils.isNotEmpty(backgroundImagePath)
            ? new FileReaderRandomBackgroundGenerator(imageWidth, imageHeight,
                    servletContext.getRealPath(backgroundImagePath))
            : new FunkyBackgroundGenerator(imageWidth, imageHeight);
    TextPaster textPaster = new RandomTextPaster(minWordLength, maxWordLength, Color.LIGHT_GRAY);
    CaptchaFactory[] captchaFactories = new CaptchaFactory[] {
            new GimpyFactory(new RandomWordGenerator(charString),
                    new ComposedWordToImage(fontGenerator, backgroundGenerator, textPaster)) };
    super.setFactories(captchaFactories);
}

From source file:unalcol.termites.boxplots.RoundNumber2.java

/**
 * Creates a new demo./*from   w  w  w.ja v  a 2  s  .  co m*/
 *
 * @param title the frame title.
 * @param pf
 */
public RoundNumber2(final String title, ArrayList<Double> pf) {

    super(title);

    final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(pf);

    final CategoryAxis xAxis = new CategoryAxis("");
    //        final NumberAxis yAxis = new NumberAxis("Round number");
    final NumberAxis yAxis = new NumberAxis("");

    yAxis.setAutoRangeIncludesZero(false);
    final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
    renderer.setFillBox(false);
    renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
    final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);

    Font font = new Font("Dialog", Font.PLAIN, 13);
    xAxis.setTickLabelFont(font);
    yAxis.setTickLabelFont(font);
    yAxis.setLabelFont(font);

    final JFreeChart chart = new JFreeChart("Round Number " + getTitle(pf),
            new Font("SansSerif", Font.BOLD, 18), plot, true);

    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(650, 370));
    setContentPane(chartPanel);
    TextTitle legendText = null;
    if (pf.size() == 1) {
        legendText = new TextTitle("Population Size");
    } else {
        legendText = new TextTitle("Population Size - Probability of Failure");
    }

    legendText.setFont(font);
    legendText.setPosition(RectangleEdge.BOTTOM);
    chart.addSubtitle(legendText);
    chart.getLegend().setItemFont(font);

    FileOutputStream output;
    try {
        output = new FileOutputStream("roundnumber2" + pf + ".jpg");
        ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 300, 250, null);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(RoundNumber2.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(RoundNumber2.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:unalcol.termites.boxplots.ECALRoundNumber.java

/**
 * Creates a new demo./*from  ww w. j  av  a  2s. c o  m*/
 *
 * @param title the frame title.
 * @param pf
 */
public ECALRoundNumber(final String title, ArrayList<Double> pf) {

    super(title);

    final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(pf);

    final CategoryAxis xAxis = new CategoryAxis("");
    //        final NumberAxis yAxis = new NumberAxis("Round number");
    final NumberAxis yAxis = new NumberAxis("");

    yAxis.setAutoRangeIncludesZero(false);
    final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
    renderer.setFillBox(false);
    renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
    final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);

    Font font = new Font("Dialog", Font.PLAIN, 13);
    xAxis.setTickLabelFont(font);
    yAxis.setTickLabelFont(font);
    yAxis.setLabelFont(font);

    final JFreeChart chart = new JFreeChart("Round Number " + getTitle(pf),
            new Font("SansSerif", Font.BOLD, 18), plot, true);

    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(650, 370));
    setContentPane(chartPanel);
    TextTitle legendText = null;
    if (pf.size() == 1) {
        legendText = new TextTitle("Population Size");
    } else {
        legendText = new TextTitle("Population Size - Probability of Failure");
    }

    legendText.setFont(font);
    legendText.setPosition(RectangleEdge.BOTTOM);
    chart.addSubtitle(legendText);
    chart.getLegend().setItemFont(font);

    FileOutputStream output;
    try {
        output = new FileOutputStream("ECALround" + pf + ".jpg");
        ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 400, 400, null);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(ECALRoundNumber.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(ECALRoundNumber.class.getName()).log(Level.SEVERE, null, ex);
    }

}