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:edu.ucla.stat.SOCR.analyses.gui.LogisticRegression.java

/**Initialize the Analysis*/
public void init() {
    showInput = false;//from w w w  .  j  ava 2  s  . c o  m
    showSelect = false;
    showVisualize = false;
    super.init();

    analysisType = AnalysisType.LOGISTIC_REGRESSION;
    useInputExample = false;
    useLocalExample = false;
    useRandomExample = true;
    useServerExample = false;

    useStaticExample = LogisticRegressionExamples.availableExamples;

    onlineDescription = "http://en.wikipedia.org/wiki/Logistic_regression";
    depMax = 1; // max number of dependent var
    indMax = 15; // max number of independent var
    resultPanelTextArea.setFont(new Font(outputFontFace, Font.BOLD, outputFontSize));
    frame = getFrame(this);
    setName("Regression & Correlation Analysis");
    // Create the toolBar
    toolBar = new JToolBar();
    createActionComponents(toolBar);
    this.getContentPane().add(toolBar, BorderLayout.NORTH);

    // use the new JFreeChar function. annie che 20060312
    chartFactory = new Chart();
    resetGraph();
    validate();
}

From source file:ubic.gemma.visualization.ExpressionDataMatrixVisualizationServiceImpl.java

@Override
@Deprecated//from   w ww  . jav  a 2  s.c om
public JFreeChart createXYLineChart(String title, Collection<double[]> dataCol, int numProfiles) {
    if (dataCol == null)
        throw new RuntimeException("dataCol cannot be " + null);

    if (dataCol.size() < numProfiles) {
        log.info("Collection smaller than number of elements.  Will display first " + NUM_PROFILES_TO_DISPLAY
                + " profiles.");
        numProfiles = NUM_PROFILES_TO_DISPLAY;
    }

    XYSeriesCollection xySeriesCollection = new XYSeriesCollection();
    Iterator<double[]> iter = dataCol.iterator();
    for (int j = 0; j < numProfiles; j++) {
        double[] data = iter.next();
        XYSeries series = new XYSeries(j, true, true);
        for (int i = 0; i < data.length; i++) {
            series.add(i, data[i]);
        }
        xySeriesCollection.addSeries(series);
    }

    JFreeChart chart = ChartFactory.createXYLineChart(title, "Platform", "Expression Value", xySeriesCollection,
            PlotOrientation.VERTICAL, false, false, false);
    chart.addSubtitle(new TextTitle("(Raw data values)", new Font("SansSerif", Font.BOLD, 14)));

    return chart;
}

From source file:NormSample.java

public void init() {

    // preparing values for the normalization forms ComboBox

    formValues.put("NFC", Normalizer.Form.NFC);
    formValues.put("NFD", Normalizer.Form.NFD);
    formValues.put("NFKC", Normalizer.Form.NFKC);
    formValues.put("NFKD", Normalizer.Form.NFKD);

    formComboBox = new JComboBox();

    for (Iterator it = formValues.keySet().iterator(); it.hasNext();) {
        formComboBox.addItem((String) it.next());
    }//w  w w. j  a  v a  2s.  co m

    // preparing samples for normalization

    // text with the acute accent symbol
    templateValues.put("acute accent", "touch" + "\u00e9");

    // text with ligature
    templateValues.put("ligature", "a" + "\ufb03" + "ance");

    // text with the cedilla
    templateValues.put("cedilla", "fa" + "\u00e7" + "ade");

    // text with half-width katakana
    templateValues.put("half-width katakana", "\uff81\uff6e\uff7a\uff9a\uff70\uff84");

    normalizationTemplate = new JComboBox();

    for (Iterator it = templateValues.keySet().iterator(); it.hasNext();) {
        normalizationTemplate.addItem((String) it.next());
    }

    // defining a component to output normalization results

    paintingComponent = new JComponent() {
        static final long serialVersionUID = -3725620407788489160L;

        public Dimension getSize() {
            return new Dimension(550, 200);
        }

        public Dimension getPreferredSize() {
            return new Dimension(550, 200);
        }

        public Dimension getMinimumSize() {
            return new Dimension(550, 200);
        }

        public void paint(Graphics g) {
            Graphics2D g2 = (Graphics2D) g;

            g2.setFont(new Font("Serif", Font.PLAIN, 20));
            g2.setColor(Color.BLACK);
            g2.drawString("Original string:", 100, 80);
            g2.drawString("Normalized string:", 100, 120);
            g2.setFont(new Font("Serif", Font.BOLD, 24));

            // output of the original sample selected from the ComboBox

            String original_string = templateValues.get(normalizationTemplate.getSelectedItem());
            g2.drawString(original_string, 320, 80);

            // normalization and output of the normalized string

            String normalized_string;
            java.text.Normalizer.Form currentForm = formValues.get(formComboBox.getSelectedItem());
            normalized_string = Normalizer.normalize(original_string, currentForm);
            g2.drawString(normalized_string, 320, 120);
        }
    };
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(paintingComponent);
    JPanel controls = new JPanel();

    controls.setLayout(new BoxLayout(controls, BoxLayout.X_AXIS));
    controls.add(new Label("Normalization Form: "));
    controls.add(formComboBox);
    controls.add(new Label("Normalization Template:"));
    controls.add(normalizationTemplate);
    add(controls);
    formComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            paintingComponent.repaint();
        }
    });

    normalizationTemplate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            paintingComponent.repaint();
        }
    });
}

From source file:net.sf.dynamicreports.test.jasper.chart.BubbleChartTest.java

@Override
public void test() {
    super.test();

    numberOfPagesTest(1);//from w  ww .  j a v  a  2 s .c o m

    JFreeChart chart = getChart("summary.chart1", 0);
    XYItemRenderer renderer = chart.getXYPlot().getRenderer();
    Assert.assertEquals("renderer", XYBubbleRenderer.class, renderer.getClass());
    Assert.assertEquals("scale type", XYBubbleRenderer.SCALE_ON_BOTH_AXES,
            ((XYBubbleRenderer) renderer).getScaleType());
    xyzChartDataTest(chart, 0, "a",
            new Number[][] { { 1d, 2d, 0.25 }, { 2d, 3d, 0.5 }, { 3d, 4d, 0.75 }, { 4d, 5d, 1d } });
    xyzChartDataTest(chart, 1, "serie1",
            new Number[][] { { 2d, 1d, 0.25 }, { 3d, 2d, 0.5 }, { 4d, 3d, 0.75 }, { 5d, 4d, 1d } });

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

From source file:org.pentaho.chart.plugin.jfreechart.dial.JFreeDialChartGeneratorIT.java

public void testScale() throws Exception {
    JFreeChart chart = getJFreeChart("testchart.xml", new Object[][] { { 8D } }); //$NON-NLS-1$
    DialPlot plot = (DialPlot) chart.getPlot();
    StandardDialScale scale = (StandardDialScale) plot.getScale(0);
    assertEquals(-20D, scale.getLowerBound());
    assertEquals(20D, scale.getUpperBound());
    assertEquals(-135D, scale.getStartAngle());
    assertEquals(-180D, scale.getExtent());

    assertEquals(5D, scale.getMajorTickIncrement());
    assertEquals(2, scale.getMinorTickCount());

    assertEquals(new Color(255, 105, 180) /*hotpink*/, scale.getTickLabelPaint());
    assertEquals(12, scale.getTickLabelFont().getSize());
    assertEquals(Font.ITALIC | Font.BOLD, scale.getTickLabelFont().getStyle());
    // had trouble getting a font comparison to work without breaking it down into size, style, and name
    assertEquals("Monospaced", scale.getTickLabelFont().getName()); //$NON-NLS-1$

    assertEquals(5F, ((BasicStroke) scale.getMajorTickStroke()).getLineWidth());
    assertEquals(3F, ((BasicStroke) scale.getMinorTickStroke()).getLineWidth());

    assertEquals(0.10D, scale.getMajorTickLength());
    assertEquals(0.05D, scale.getMinorTickLength());

}

From source file:com.sec.ose.osi.ui.dialog.setting.JPanProxySetting.java

private JPanel getJPanelValue() {
    if (jPanelValue == null) {

        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.gridx = 1;/* www . j  a v a 2s . c o m*/
        gridBagConstraints3.weighty = 1.0;
        gridBagConstraints3.weightx = 0.0;
        gridBagConstraints3.gridy = 4;
        jLabelEmpty = new JLabel();
        jLabelEmpty.setText("");
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.gridx = 0;
        gridBagConstraints2.gridy = 3;
        jPanelValue = new JPanel();
        jPanelValue.setLayout(new GridBagLayout());
        jPanelValue.setBorder(BorderFactory.createTitledBorder(null, "", TitledBorder.DEFAULT_JUSTIFICATION,
                TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
        jPanelValue.setPreferredSize(new Dimension(400, 200));
        jPanelValue.add(jLabelEmpty, gridBagConstraints3);

        JLabel jLabelProxyHost = new JLabel("Proxy Host : ", JLabel.RIGHT);
        GridBagConstraints gridBagConstraintsjLabelProxyHost = new GridBagConstraints();
        gridBagConstraintsjLabelProxyHost.gridx = 0;
        gridBagConstraintsjLabelProxyHost.insets = new Insets(10, 20, 5, 0);
        gridBagConstraintsjLabelProxyHost.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsjLabelProxyHost.weightx = 0.0;
        gridBagConstraintsjLabelProxyHost.weighty = 0.0;
        gridBagConstraintsjLabelProxyHost.gridy = 1;
        jPanelValue.add(jLabelProxyHost, gridBagConstraintsjLabelProxyHost);

        GridBagConstraints gridBagConstraintsgetJTextFieldProxyHost = new GridBagConstraints();
        gridBagConstraintsgetJTextFieldProxyHost.gridx = 1;
        gridBagConstraintsgetJTextFieldProxyHost.weightx = 1.0;
        gridBagConstraintsgetJTextFieldProxyHost.fill = GridBagConstraints.BOTH;
        gridBagConstraintsgetJTextFieldProxyHost.insets = new Insets(10, 5, 5, 100);
        gridBagConstraintsgetJTextFieldProxyHost.gridwidth = 2;
        gridBagConstraintsgetJTextFieldProxyHost.gridy = 1;
        jPanelValue.add(getJTextFieldProxyHost(), gridBagConstraintsgetJTextFieldProxyHost);

        JLabel jLabelProxyPort = new JLabel("Proxy Port : ", JLabel.RIGHT);
        GridBagConstraints gridBagConstraintsjLabelProxyPort = new GridBagConstraints();
        gridBagConstraintsjLabelProxyPort.gridx = 0;
        gridBagConstraintsjLabelProxyPort.insets = new Insets(0, 20, 0, 0);
        gridBagConstraintsjLabelProxyPort.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsjLabelProxyPort.weighty = 0.0;
        gridBagConstraintsjLabelProxyPort.gridy = 2;
        jPanelValue.add(jLabelProxyPort, gridBagConstraintsjLabelProxyPort);

        GridBagConstraints gridBagConstraintsgetJTextFieldProxyPort = new GridBagConstraints();
        gridBagConstraintsgetJTextFieldProxyPort.gridx = 1;
        gridBagConstraintsgetJTextFieldProxyPort.weightx = 1.0;
        gridBagConstraintsgetJTextFieldProxyPort.fill = GridBagConstraints.BOTH;
        gridBagConstraintsgetJTextFieldProxyPort.insets = new Insets(5, 5, 5, 220);
        gridBagConstraintsgetJTextFieldProxyPort.weighty = 0.0;
        gridBagConstraintsgetJTextFieldProxyPort.anchor = GridBagConstraints.CENTER;
        gridBagConstraintsgetJTextFieldProxyPort.gridy = 2;
        jPanelValue.add(getJTextFieldProxyPort(), gridBagConstraintsgetJTextFieldProxyPort);

        JLabel jLabelProxyBypass = new JLabel("Proxy Bypass : ", JLabel.RIGHT);
        GridBagConstraints gridBagConstraintsjLabelProxyBypass = new GridBagConstraints();
        gridBagConstraintsjLabelProxyBypass.gridx = 0;
        gridBagConstraintsjLabelProxyBypass.insets = new Insets(0, 20, 0, 0);
        gridBagConstraintsjLabelProxyBypass.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsjLabelProxyBypass.weighty = 0.0;
        gridBagConstraintsjLabelProxyBypass.gridy = 3;
        jPanelValue.add(jLabelProxyBypass, gridBagConstraintsjLabelProxyBypass);

        GridBagConstraints gridBagConstraintsgetJTextFieldProxyBypass = new GridBagConstraints();
        gridBagConstraintsgetJTextFieldProxyBypass.gridx = 1;
        gridBagConstraintsgetJTextFieldProxyBypass.weightx = 1.0;
        gridBagConstraintsgetJTextFieldProxyBypass.fill = GridBagConstraints.BOTH;
        gridBagConstraintsgetJTextFieldProxyBypass.insets = new Insets(5, 5, 5, 100);
        gridBagConstraintsgetJTextFieldProxyBypass.weighty = 0.0;
        gridBagConstraintsgetJTextFieldProxyBypass.anchor = GridBagConstraints.CENTER;
        gridBagConstraintsgetJTextFieldProxyBypass.gridy = 3;
        jPanelValue.add(getJTextFieldProxyBypass(), gridBagConstraintsgetJTextFieldProxyBypass);

        //jPanelValue.add(getJPanel(), gridBagConstraints2);

    }
    return jPanelValue;
}

From source file:RadialGradientApp.java

@Override
protected void paintComponent(Graphics g) {
    setFont(getFont().deriveFont(70.f).deriveFont(Font.BOLD));

    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    // Retains the previous state
    Paint oldPaint = g2.getPaint();

    // Fills the circle with solid blue color
    g2.setColor(new Color(0x0153CC));
    g2.fillOval(0, 0, getWidth() - 1, getHeight() - 1);

    // Adds shadows at the top
    Paint p;//  www. j  a  va 2s  .co m
    p = new GradientPaint(0, 0, new Color(0.0f, 0.0f, 0.0f, 0.4f), 0, getHeight(),
            new Color(0.0f, 0.0f, 0.0f, 0.0f));
    g2.setPaint(p);
    g2.fillOval(0, 0, getWidth() - 1, getHeight() - 1);

    // Adds highlights at the bottom 
    p = new GradientPaint(0, 0, new Color(1.0f, 1.0f, 1.0f, 0.0f), 0, getHeight(),
            new Color(1.0f, 1.0f, 1.0f, 0.4f));
    g2.setPaint(p);
    g2.fillOval(0, 0, getWidth() - 1, getHeight() - 1);

    // Creates dark edges for 3D effect
    p = new RadialGradientPaint(new Point2D.Double(getWidth() / 2.0, getHeight() / 2.0), getWidth() / 2.0f,
            new float[] { 0.0f, 1.0f },
            new Color[] { new Color(6, 76, 160, 127), new Color(0.0f, 0.0f, 0.0f, 0.8f) });
    g2.setPaint(p);
    g2.fillOval(0, 0, getWidth() - 1, getHeight() - 1);

    // Adds oval inner highlight at the bottom
    p = new RadialGradientPaint(new Point2D.Double(getWidth() / 2.0, getHeight() * 1.5), getWidth() / 2.3f,
            new Point2D.Double(getWidth() / 2.0, getHeight() * 1.75 + 6), new float[] { 0.0f, 0.8f },
            new Color[] { new Color(64, 142, 203, 255), new Color(64, 142, 203, 0) },
            RadialGradientPaint.CycleMethod.NO_CYCLE, RadialGradientPaint.ColorSpaceType.SRGB,
            AffineTransform.getScaleInstance(1.0, 0.5));
    g2.setPaint(p);
    g2.fillOval(0, 0, getWidth() - 1, getHeight() - 1);

    // Adds oval specular highlight at the top left
    p = new RadialGradientPaint(new Point2D.Double(getWidth() / 2.0, getHeight() / 2.0), getWidth() / 1.4f,
            new Point2D.Double(45.0, 25.0), new float[] { 0.0f, 0.5f },
            new Color[] { new Color(1.0f, 1.0f, 1.0f, 0.4f), new Color(1.0f, 1.0f, 1.0f, 0.0f) },
            RadialGradientPaint.CycleMethod.NO_CYCLE);
    g2.setPaint(p);
    g2.fillOval(0, 0, getWidth() - 1, getHeight() - 1);

    // Restores the previous state
    g2.setPaint(oldPaint);

    // Draws the logo        
    //        FontRenderContext context = g2.getFontRenderContext();
    //        TextLayout layout = new TextLayout("R", getFont(), context);
    //        Rectangle2D bounds = layout.getBounds();
    //        
    //        float x = (getWidth() - (float) bounds.getWidth()) / 2.0f;
    //        float y = (getHeight() + (float) bounds.getHeight()) / 2.0f;
    //        
    //        g2.setColor(Color.WHITE);
    //        layout.draw(g2, x, y);
    //        
    //        Area shadow = new Area(layout.getOutline(null));
    //        shadow.subtract(new Area(layout.getOutline(AffineTransform.getTranslateInstance(1.0, 1.0))));
    //        g2.setColor(Color.BLACK);
    //        g2.translate(x, y);
    //        g2.fill(shadow);
    //        g2.translate(-x, -y);
}

From source file:com.fengduo.bee.commons.servlet.ValidateCodeServlet.java

private String createCharacter(Graphics g) {
    char[] codeSeq = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U',
            'V', 'W', 'X', 'Y', 'Z', '2', '3', '4', '5', '6', '7', '8', '9' };
    String[] fontTypes = { "Arial", "Arial Black", "AvantGarde Bk BT", "Calibri" };
    Random random = new Random();
    StringBuilder s = new StringBuilder();
    for (int i = 0; i < 4; i++) {
        String r = String.valueOf(codeSeq[random.nextInt(codeSeq.length)]);// random.nextInt(10));
        g.setColor(new Color(50 + random.nextInt(100), 50 + random.nextInt(100), 50 + random.nextInt(100)));
        g.setFont(new Font(fontTypes[random.nextInt(fontTypes.length)], Font.BOLD, 26));
        g.drawString(r, 15 * i + 5, 19 + random.nextInt(8));
        // g.drawString(r, i*w/4, h-5);
        s.append(r);// w  w  w.  ja va2  s. c  o  m
    }
    return s.toString();
}

From source file:NwFontChooserS.java

private void showSample() {
    int g = 0;/*from   w  ww .java  2  s.  c om*/
    try {
        g = Integer.parseInt(SizeList.getSelectedValue());
    } catch (NumberFormatException nfe) {
    }
    String st = StyleList.getSelectedValue();
    int s = Font.PLAIN;
    if (st.equalsIgnoreCase("Bold"))
        s = Font.BOLD;
    if (st.equalsIgnoreCase("Italic"))
        s = Font.ITALIC;
    Sample.setFont(new Font(FontList.getSelectedValue(), s, g));
    Sample.setText("The quick brown fox jumped over the lazy dog.");
}

From source file:com.game.ui.views.ItemPanel.java

public void doCommonStuffForContent() {
    JPanel panel1 = new JPanel();
    panel1.setAlignmentX(0);/* ww w.  j a va 2s  .c  om*/
    panel1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel1.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.insets = new Insets(5, 5, 5, 5);
    c.weightx = 1;
    c.weighty = 0.2;
    c.gridwidth = 2;
    JLabel dtlLbl = new JLabel(type + "Details : ");
    dtlLbl.setFont(new Font("Times New Roman", Font.BOLD, 15));
    panel1.add(dtlLbl, c);
    c.gridwidth = 1;
    c.gridy = 1;
    JLabel nameLbl = new JLabel("Name : ");
    panel1.add(nameLbl, c);
    c.gridx = 1;
    JTextField name = new JTextField("");
    name.setColumns(20);
    panel1.add(name, c);
    if (ringPanel) {
        createComponentsForRing(panel1, c);
    } else if (armourPanel) {
        createComponentsForArmour(panel1, c);
    } else if (potionPanel) {
        createComponentsForPotion(panel1, c);
    } else if (treasurePanel) {
        createComponentsForTreasure(panel1, c);
    }
    c.gridx = 0;
    c.gridy = c.gridy + 1;
    c.gridwidth = 2;
    JButton submit = new JButton("Save");
    submit.addActionListener(this);
    submit.setActionCommand("button");
    panel1.add(submit, c);
    c.gridx = 0;
    c.gridy = c.gridy + 1;
    c.gridwidth = 2;
    c.weighty = 0;
    c.weightx = 1;
    validationMess = new JLabel("Pls enter all the fields or pls choose a " + type + " from the drop down");
    validationMess.setForeground(Color.red);
    validationMess.setVisible(false);
    panel1.add(validationMess, c);
    c.gridy++;
    c.weighty = 1;
    c.weightx = 1;
    panel1.add(new JPanel(), c);
    panel1.setBorder(LineBorder.createGrayLineBorder());
    add(panel1);
    add(Box.createVerticalGlue());
}