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:com.okmich.hackerday.client.tool.dashboard.ReportItemPanel.java

/**
 *
 * @return A panel.//from  w  ww. j  av  a 2  s. co m
 */
public JPanel createChartPanel() {
    JFreeChart chart = ChartFactory.createPieChart(title, // chart title
            getChartDataset(), // data
            true, // include legend
            true, false);

    TextTitle textTitle = new TextTitle(title, new Font("SansSerif", Font.BOLD, 16));
    chart.setTitle(textTitle);
    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.setNoDataMessage("No data available");
    plot.setCircular(false);
    plot.setLabelGap(0.02);

    LegendTitle legend = chart.getLegend();
    legend.setPosition(RectangleEdge.BOTTOM);
    this.chartPanel = new ChartPanel(chart);
    this.chartPanel.addMouseListener(new MouseListenerImpl(this));

    return this.chartPanel;
}

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

/**
 * Creates a new demo./* w  ww.j  av a2  s .  com*/
 *
 * @param title the frame title.
 * @param pf
 */
public BestAgentsRoundInfoCollected(final String title, ArrayList<Double> pf) {

    super(title);
    String sDirectorio = experimentsDir;

    Hashtable<String, List> info = new Hashtable();

    /*for (String mode : aMode) {
    info.put(mode, new ArrayList());
    }*/

    createSampleDataset(pf, info);
    AddDataFailingExperiments(sDirectorio, pf, info);
    final BoxAndWhiskerCategoryDataset dataset = addDataSet(info);
    System.out.println("info" + info);
    final CategoryAxis xAxis = new CategoryAxis("");
    //final NumberAxis yAxis = new NumberAxis("Information Collected");
    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 of Best Agents " + 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("BestAgentsRound" + pf + mazeMode + ".jpg");
        ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 450, 350, null);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(BestAgentsRoundInfoCollected.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(BestAgentsRoundInfoCollected.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:org.aksw.iguana.reborn.charts.datasets.StatisticalBarChartDemo.java

/**
 * Creates a new demo.// w  w w .ja  va2  s .  c om
 *
 * @param title
 *            the frame title.
 * @throws DocumentException
 * @throws FileNotFoundException
 */
public StatisticalBarChartDemo(final String title) throws FileNotFoundException, DocumentException {

    super(title);
    final StatisticalCategoryDataset dataset = createDataset();

    final CategoryAxis xAxis = new CategoryAxis("Type");
    xAxis.setLowerMargin(0.01d); // percentage of space before first bar
    xAxis.setUpperMargin(0.01d); // percentage of space after last bar
    xAxis.setCategoryMargin(0.05d); // percentage of space between
    // categories
    final ValueAxis yAxis = new NumberAxis("Value");

    // define the plot
    final CategoryItemRenderer renderer = new StatisticalBarRenderer();
    final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);

    final JFreeChart chart = new JFreeChart("Statistical Bar Chart Demo", new Font("Helvetica", Font.BOLD, 14),
            plot, true);
    ChartUtilities2.saveChartAsPDF(new File("/home/raven/tmp/foo.pdf"), chart, 1000, 300);

    // chart.setBackgroundPaint(Color.white);
    // add the chart to a panel...
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    setContentPane(chartPanel);

}

From source file:Visuals.BarChart.java

public ChartPanel drawBarChart() {
    DefaultCategoryDataset bardataset = new DefaultCategoryDataset();
    bardataset.addValue(new Double(low), "Low (" + low + ")", lowValue);
    bardataset.addValue(new Double(medium), "Medium (" + medium + ")", mediumValue);
    bardataset.addValue(new Double(high), "High (" + high + ")", highValue);
    bardataset.addValue(new Double(critical), "Critical (" + critical + ")", criticalValue);

    JFreeChart barchart = ChartFactory.createBarChart(title, // Title  
            riskCategory, riskCountTitle, bardataset // Dataset   
    );//from   w  w  w  .  ja v  a 2  s.  c o  m

    final CategoryPlot plot = barchart.getCategoryPlot();
    CategoryItemRenderer renderer = new CustomRenderer();
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    renderer.setBaseItemLabelGenerator(
            new StandardCategoryItemLabelGenerator(riskCountTitle, NumberFormat.getInstance()));

    DecimalFormat df = new DecimalFormat("##");
    renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", df));
    Font m1Font;
    m1Font = new Font("Cambria", Font.BOLD, 16);
    renderer.setItemLabelFont(m1Font);
    renderer.setItemLabelPaint(null);

    //barchart.removeLegend();
    plot.setRenderer(renderer);
    //renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE5, TextAnchor.CENTER));
    //renderer.setItemLabelsVisible(true);
    barchart.getCategoryPlot().setRenderer(renderer);

    LegendItemCollection chartLegend = new LegendItemCollection();
    Shape shape = new Rectangle(10, 10);
    chartLegend.add(new LegendItem("Low (" + low + ")", null, null, null, shape, new Color(230, 219, 27)));
    chartLegend
            .add(new LegendItem("Medium (" + medium + ")", null, null, null, shape, new Color(85, 144, 176)));
    chartLegend.add(new LegendItem("High (" + high + ")", null, null, null, shape, new Color(230, 90, 27)));
    chartLegend.add(
            new LegendItem("Critical (" + critical + ")", null, null, null, shape, new Color(230, 27, 27)));
    plot.setFixedLegendItems(chartLegend);
    plot.setBackgroundPaint(new Color(210, 234, 243));
    ChartPanel chartPanel = new ChartPanel(barchart);
    return chartPanel;
}

From source file:FontChooser.java

private String styleToString(int style) {
    String str = "";
    if ((style & Font.BOLD) == Font.BOLD) {
        if (str.length() > 0) {
            str += ",";
        }//from  w w w.  ja  v  a2s.  c  o m
        str += "Bold";
    }
    if ((style & Font.ITALIC) == Font.ITALIC) {
        if (str.length() > 0) {
            str += ",";
        }
        str += "Italic";
    }
    if (str.length() <= 0) {
        str = "Plain";
    }
    return str;
}

From source file:org.adempiere.webui.apps.graph.jfreegraph.PerformanceGraphBuilder.java

public JFreeChart createIndicatorChart(IndicatorModel model) {
    JFreeChart chart = null;/*from   w w w.  jav  a2 s. c o m*/
    DefaultValueDataset data = new DefaultValueDataset((float) model.goalModel.getPercent());
    MeterPlot plot = new MeterPlot(data);

    MColorSchema colorSchema = model.goalModel.getColorSchema();
    int rangeLo = 0;
    int rangeHi = 0;
    Point2D start = new Point2D.Float(0, 0);
    Point2D end = new Point2D.Float(50, 50);
    float[] dist = { 0.0f, 0.2f, 0.45f, 0.75f, 1.0f };
    for (int i = 1; i <= 4; i++) {
        switch (i) {
        case 1:
            rangeHi = colorSchema.getMark1Percent();
            break;
        case 2:
            rangeHi = colorSchema.getMark2Percent();
            break;
        case 3:
            rangeHi = colorSchema.getMark3Percent();
            break;
        case 4:
            rangeHi = colorSchema.getMark4Percent();
            break;
        }
        if (rangeHi == 9999)
            rangeHi = (int) Math.floor(rangeLo * 1.5);
        if (rangeLo < rangeHi) {
            Color[] colors = { colorSchema.getColor(rangeHi).brighter().brighter(),
                    colorSchema.getColor(rangeHi).brighter(), colorSchema.getColor(rangeHi),
                    colorSchema.getColor(rangeHi).darker(), colorSchema.getColor(rangeHi).darker().darker() };
            LinearGradientPaint p = new LinearGradientPaint(start, end, dist, colors);

            plot.addInterval(new MeterInterval("Normal", //label
                    new Range(rangeLo, rangeHi), //range
                    p, new BasicStroke(7.0f), model.dialBackground));
            rangeLo = rangeHi;
        }
    }
    plot.setRange(new Range(0, rangeLo));
    plot.setDialBackgroundPaint(model.dialBackground);
    plot.setUnits("");
    plot.setDialShape(DialShape.CHORD);
    plot.setNeedlePaint(model.needleColor);
    plot.setTickSize(2000);
    plot.setTickLabelFont(new Font("SansSerif", Font.BOLD, 8));
    plot.setValueFont(new Font("SansSerif", Font.BOLD, 8));
    plot.setNoDataMessageFont(new Font("SansSerif", Font.BOLD, 8));
    plot.setTickLabelPaint(model.tickColor);
    plot.setValuePaint(new Color(0.0f, 0.0f, 0.0f, 0.0f));
    plot.setTickPaint(model.tickColor);
    //
    chart = new JFreeChart("", new Font("SansSerif", Font.BOLD, 9), plot, false);

    return chart;
}

From source file:sanger.team16.gui.genevar.eqtl.query.SNPGeneAssocPlot.java

public SNPGeneAssocPlot(List<Tuple> tuples, double max, double min) throws ArrayIndexOutOfBoundsException {
    JPanel mainPanel = new JPanel(new GridLayout(0, 3));
    mainPanel.setBackground(Color.white);

    int size = tuples.size();
    for (int i = 0; i < size; i++) {
        Tuple tuple = tuples.get(i);//  w w  w. java2  s  .com
        String populationName = tuple.populationName;

        // if (trait.expressionRanks != null) {   // BUG FIXED 02/02/10
        if (tuple.phenotypes != null && tuple.phenotypes.length != 0) {
            CategoryDataset dataset = this.createDataset(tuple);
            JFreeChart chart = createChart(populationName, dataset, max, min);
            chart.setBackgroundPaint(Color.white);

            TextTitle textTitle = new TextTitle(tuple.subtitle);
            textTitle.setFont(new Font("SansSerif", Font.PLAIN, 12));
            //subtitle1.setPosition(RectangleEdge.BOTTOM);
            textTitle.setHorizontalAlignment(HorizontalAlignment.CENTER);
            chart.addSubtitle(textTitle);

            ChartPanel chartPanel = new ChartPanel(chart);
            chartPanel.setPreferredSize(this.getAutoPreferredSize()); // Original Dimension(680, 420)
            mainPanel.add(chartPanel);

        } else {
            BaseJPane empty = new BaseJPane(2, 50, 0, 0);
            empty.setPreferredSize(this.getAutoPreferredSize());
            BaseJPane na = new BaseJPane();
            na.setLayout(new BorderLayout());

            JLabel name = new JLabel("      " + populationName);
            name.setFont(new Font("Arial", Font.BOLD, 12));
            name.setForeground(Color.gray);
            na.add(name, BorderLayout.PAGE_START);

            JLabel message = new JLabel("Not Available");
            message.setForeground(Color.lightGray);
            na.add(message, BorderLayout.CENTER);

            empty.add(Box.createHorizontalGlue());
            empty.add(na);
            empty.add(Box.createHorizontalGlue());
            empty.setBaseSpringBox();

            mainPanel.add(empty);
        }
    }

    this.add(mainPanel);
}

From source file:com.floreantpos.ui.views.LoginPasswordEntryView.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//from w  ww. jav a 2  s  . c  o m
 */
// <editor-fold defaultstate="collapsed"
// desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    buttonPanel = new javax.swing.JPanel();
    bottomPanel = new javax.swing.JPanel();

    btnShutdown = new com.floreantpos.swing.PosButton();

    setPreferredSize(new Dimension(320, 593));
    setLayout(new BorderLayout());

    buttonPanel.setOpaque(false);
    buttonPanel.setPreferredSize(new java.awt.Dimension(200, 180));
    buttonPanel.setLayout(new MigLayout("", "[111px][111px][111px,grow]", "[60px][60px][60px][60px]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    lblTerminalId = new JLabel("TERMINAL ID:"); //$NON-NLS-1$
    lblTerminalId.setForeground(Color.BLACK);
    lblTerminalId.setFont(new Font("Dialog", Font.BOLD, 18)); //$NON-NLS-1$
    lblTerminalId.setHorizontalAlignment(SwingConstants.CENTER);
    add(lblTerminalId, BorderLayout.NORTH);

    bottomPanel.setLayout(new MigLayout("hidemode 3, fill")); //$NON-NLS-1$
    bottomPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));

    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(btnRegularMode);
    //buttonGroup.add(btnCashierMode);
    buttonGroup.add(btnKitchenMode);

    btnRegularMode.setFocusable(false);
    //      btnCashierMode.setFocusable(false);
    btnKitchenMode.setFocusable(false);

    ModeSelectionListener l = new ModeSelectionListener();
    btnRegularMode.addActionListener(l);
    //      btnCashierMode.addActionListener(l);
    btnKitchenMode.addActionListener(l);

    btnRegularMode.setSelected(TerminalConfig.isRegularMode());
    //      btnCashierMode.setSelected(TerminalConfig.isCashierMode());
    btnKitchenMode.setSelected(TerminalConfig.isKitchenMode());

    if (!btnRegularMode.isSelected() && !btnKitchenMode.isSelected()) {
        btnRegularMode.setSelected(true);
    }

    JPanel modePanel = new JPanel(new GridLayout(1, 0, 2, 2));
    modePanel.add(btnRegularMode);
    //      modePanel.add(btnCashierMode);
    modePanel.add(btnKitchenMode);

    bottomPanel.add(modePanel, "h 60!, grow, wrap"); //$NON-NLS-1$

    psbtnLogin = new PosButton();
    psbtnLogin.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doLogin();
        }
    });
    psbtnLogin.setText("LOGIN"); //$NON-NLS-1$
    bottomPanel.add(psbtnLogin, "grow, wrap, gapbottom 20px"); //$NON-NLS-1$

    PosButton btnClockOUt = new PosButton(new ClockInOutAction(false, true));
    bottomPanel.add(btnClockOUt, "grow, wrap, h 60!"); //$NON-NLS-1$

    if (TerminalConfig.isShowDbConfigureButton()) {
        btnConfigureDatabase = new com.floreantpos.swing.PosButton();
        btnConfigureDatabase.setAction(goAction);
        btnConfigureDatabase.setText(com.floreantpos.POSConstants.CONFIGURE_DATABASE);
        btnConfigureDatabase.setFocusable(false);
        btnConfigureDatabase.setActionCommand("DBCONFIG"); //$NON-NLS-1$
        bottomPanel.add(btnConfigureDatabase, "grow, wrap, h 60!"); //$NON-NLS-1$
    }

    btnShutdown.setAction(goAction);
    btnShutdown.setText(com.floreantpos.POSConstants.SHUTDOWN);
    btnShutdown.setFocusable(false);

    if (TerminalConfig.isFullscreenMode()) {
        if (btnConfigureDatabase != null) {
            btnConfigureDatabase.setVisible(false);
        }
        if (btnShutdown != null) {
            btnShutdown.setVisible(false);
        }
    }

    bottomPanel.add(btnShutdown, "grow, wrap, h 60!"); //$NON-NLS-1$
    add(bottomPanel, BorderLayout.SOUTH);

    lblTerminalId.setText(""); //$NON-NLS-1$
}

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

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

    super(title);
    String sDirectorio = experimentsDir;

    Hashtable<String, List> info = new Hashtable();

    //String[] aMode = {"levywalk", "lwphevap", "hybrid", "hybrid3", "hybrid4"};
    /*for (String mode : aMode) {
     info.put(mode, new ArrayList());
     }*/
    createSampleDataset(pf, info);
    AddDataFailingExperiments(sDirectorio, pf, info);
    final BoxAndWhiskerCategoryDataset dataset = addDataSet(info);

    final CategoryAxis xAxis = new CategoryAxis("");
    //final NumberAxis yAxis = new NumberAxis("Information Collected");
    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("Information Collected " + 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("BestAgentsPercentageInfoCollected" + pf + mazeMode + ".jpg");
        ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 350, 350, null);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(BestAgentsPercentageInfoCollected.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(BestAgentsPercentageInfoCollected.class.getName()).log(Level.SEVERE, null, ex);
    }
}

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

public ChartPanel get_ChartPanel(int width, int height) {
    chr = new ChartPanel(chart);
    chr.setBackground(Color.blue);

    chr.setBounds(5, 5, width - 5, height - 10);
    chr.setVisible(true);//from  w w w . ja  va2 s  . c o  m
    chr.setMouseWheelEnabled(true);
    chr.addChartMouseListener(new ChartMouseListener() {

        public void chartMouseMoved(ChartMouseEvent chartmouseevent) {

        }

        public void chartMouseClicked(ChartMouseEvent chartmouseevent) {

            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    XYPlot xyplot = (XYPlot) chr.getChart().getPlot();
                    xyplot.clearAnnotations();
                    double x, y;
                    x = new BigDecimal(xyplot.getDomainCrosshairValue()).setScale(3, RoundingMode.UP)
                            .doubleValue();

                    y = new BigDecimal(xyplot.getRangeCrosshairValue()).setScale(3, RoundingMode.UP)
                            .doubleValue();
                    XYTextAnnotation annotation = new XYTextAnnotation("(" + x + ", " + y + ")",
                            new BigDecimal(x).setScale(3, RoundingMode.UP).doubleValue(), y);
                    annotation.setFont(new Font("serif", Font.BOLD, 15));
                    annotation.setTextAnchor(TextAnchor.BOTTOM_CENTER);
                    xyplot.addAnnotation(annotation);
                }
            });
        }
    });

    return chr;
}