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.AnovaOneWay.java

/**Initialize the Analysis*/
public void init() {
    showInput = false;//from w  ww  .  java  2  s .co  m
    showSelect = false;
    showVisualize = false;
    super.init();
    analysisType = AnalysisType.ANOVA_ONE_WAY;
    useInputExample = false;
    useLocalExample = false;
    useRandomExample = true;
    useServerExample = false;
    useStaticExample = new boolean[] { true, true, true, true, true, false, false, false, false, false };//AnovaOneWayExamples.availableExamples;

    useGraph = true;
    onlineDescription = "http://mathworld.wolfram.com/ANOVA.html";
    depMax = 1; // max number of dependent var
    indMax = 1; // max number of independent var
    resultPanelTextArea.setFont(new Font(outputFontFace, Font.BOLD, outputFontSize));
    frame = getFrame(this);
    setName("One Way ANOVA");
    // Create the toolBar
    toolBar = new JToolBar();
    createActionComponents(toolBar);
    this.getContentPane().add(toolBar, BorderLayout.NORTH);

    resetGraph();

    validate();
    //reset();
}

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

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

    numberOfPagesTest(1);/*from www.jav  a 2s.c o m*/

    JFreeChart chart = getChart("summary.chart1", 0);
    CategoryPlot categoryPlot = chart.getCategoryPlot();
    Assert.assertEquals("renderer", StackedBarRenderer.class, categoryPlot.getRenderer().getClass());
    Assert.assertTrue("show labels", categoryPlot.getRenderer().getBaseItemLabelsVisible());
    Assert.assertFalse("show tick labels", categoryPlot.getDomainAxis().isTickMarksVisible());
    Assert.assertFalse("show tick marks", categoryPlot.getDomainAxis().isTickLabelsVisible());

    chart = getChart("summary.chart2", 0);
    Axis axis = chart.getCategoryPlot().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());
    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.chart3", 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:net.sf.dynamicreports.test.jasper.chart.WaterfallBarChartTest.java

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

    numberOfPagesTest(1);//  w  w w . j a v  a2 s  .  c o  m

    JFreeChart chart = getChart("summary.chart1", 0);
    CategoryPlot categoryPlot = chart.getCategoryPlot();
    Assert.assertEquals("renderer", WaterfallBarRenderer.class, categoryPlot.getRenderer().getClass());
    Assert.assertTrue("show labels", categoryPlot.getRenderer().getBaseItemLabelsVisible());
    Assert.assertFalse("show tick labels", categoryPlot.getDomainAxis().isTickMarksVisible());
    Assert.assertFalse("show tick marks", categoryPlot.getDomainAxis().isTickLabelsVisible());

    chart = getChart("summary.chart2", 0);
    Axis axis = chart.getCategoryPlot().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());
    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.chart3", 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:esmska.gui.AboutFrame.java

/** This method is called from within the constructor to
 * initialize the form./*from   w w w  .ja v a  2  s. com*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jLabel1 = new JLabel();
    jLabel2 = new JLabel();
    jLabel3 = new JLabel();
    creditsButton = new JButton();
    closeButton = new JButton();
    licenseButton = new JButton();
    jLabel5 = new JLabel();
    jLabel4 = new JLabel();
    jLabel6 = new JLabel();
    jLabel7 = new JLabel();
    jLabel8 = new JLabel();
    homeHyperlink = new JXHyperlink();
    supportHyperlink = new JXHyperlink();

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    ResourceBundle bundle = ResourceBundle.getBundle("esmska/resources/l10n"); // NOI18N
    setTitle(bundle.getString("AboutFrame.title")); // NOI18N
    setLocationByPlatform(true);

    jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel1.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/esmska.png"))); // NOI18N
    jLabel1.setFocusable(false);

    jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() | Font.BOLD,
            jLabel2.getFont().getSize() + 22));
    jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
    Mnemonics.setLocalizedText(jLabel2, "Esmska " + config.getLatestVersion());
    jLabel2.setFocusable(false);

    jLabel3.setHorizontalAlignment(SwingConstants.CENTER);
    Mnemonics.setLocalizedText(jLabel3, bundle.getString("AboutFrame.jLabel3.text")); // NOI18N
    jLabel3.setFocusable(false);

    creditsButton.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/about-22.png"))); // NOI18N
    Mnemonics.setLocalizedText(creditsButton, bundle.getString("AboutFrame.creditsButton.text"));
    creditsButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            creditsButtonActionPerformed(evt);
        }
    });

    closeButton.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/close-22.png"))); // NOI18N
    Mnemonics.setLocalizedText(closeButton, bundle.getString("Close_"));
    closeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            closeButtonActionPerformed(evt);
        }
    });
    Mnemonics.setLocalizedText(licenseButton, bundle.getString("AboutFrame.licenseButton.text"));
    licenseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            licenseButtonActionPerformed(evt);
        }
    });

    jLabel5.setFont(jLabel5.getFont().deriveFont(jLabel5.getFont().getSize() - 2f));
    jLabel5.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel5.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/copyleft-12.png"))); // NOI18N
    Mnemonics.setLocalizedText(jLabel5, bundle.getString("AboutFrame.jLabel5.text")); // NOI18N
    jLabel5.setFocusable(false);

    setURI(homeHyperlink, Links.getURI(Links.HOMEPAGE));
    Mnemonics.setLocalizedText(homeHyperlink, l10n.getString("AboutFrame.homeHyperlink.text"));
    homeHyperlink.setToolTipText(l10n.getString("AboutFrame.homeHyperlink.toolTipText")); // NOI18N
    setURI(supportHyperlink, Links.getURI(Links.DONATE));
    Mnemonics.setLocalizedText(supportHyperlink, l10n.getString("AboutFrame.supportHyperlink.text"));
    supportHyperlink.setToolTipText(l10n.getString("AboutFrame.supportHyperlink.toolTipText")); // NOI18N
    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout
            .createSequentialGroup().addContainerGap()
            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                    .addComponent(jLabel5, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE)
                    .addComponent(homeHyperlink, Alignment.CENTER, GroupLayout.PREFERRED_SIZE,
                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(supportHyperlink, Alignment.CENTER, GroupLayout.PREFERRED_SIZE,
                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE)
                    .addComponent(jLabel2, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE)
                    .addComponent(jLabel1, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup().addComponent(creditsButton)
                            .addPreferredGap(ComponentPlacement.RELATED).addComponent(licenseButton)
                            .addPreferredGap(ComponentPlacement.RELATED, 151, Short.MAX_VALUE)
                            .addComponent(closeButton))
                    .addGroup(layout.createSequentialGroup()
                            .addComponent(jLabel4, GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE)
                            .addGap(108, 108, 108)
                            .addComponent(jLabel6, GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                            .addComponent(jLabel8, GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE)
                            .addGap(138, 138, 138)
                            .addComponent(jLabel7, GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE)))
            .addContainerGap()));

    layout.linkSize(SwingConstants.HORIZONTAL, new Component[] { closeButton, creditsButton, licenseButton });

    layout.setVerticalGroup(
            layout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING,
                    layout.createSequentialGroup().addContainerGap().addComponent(jLabel1).addGap(18, 18, 18)
                            .addComponent(jLabel2).addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(jLabel3).addPreferredGap(ComponentPlacement.UNRELATED)
                            .addComponent(jLabel5).addGap(18, 18, 18)
                            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                                                    .addComponent(jLabel4).addComponent(jLabel6))
                                            .addPreferredGap(ComponentPlacement.RELATED)
                                            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                                                    .addComponent(jLabel7).addComponent(jLabel8)))
                                    .addComponent(homeHyperlink, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addComponent(supportHyperlink, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.RELATED, 48, Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(creditsButton)
                                    .addComponent(closeButton).addComponent(licenseButton))
                            .addContainerGap()));

    layout.linkSize(SwingConstants.VERTICAL, new Component[] { jLabel4, jLabel6 });

    layout.linkSize(SwingConstants.VERTICAL, new Component[] { closeButton, creditsButton, licenseButton });

    pack();
}

From source file:net.sf.profiler4j.console.ClassListPanel.java

/**
 * This method initializes classesTable//w  w w .  j  ava  2  s .  c  o m
 * 
 * @return javax.swing.JTable
 */
private JTable getClassesTable() {
    if (classesTable == null) {
        classesTable = new JTable();
        classesTable.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        classesTable.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 12));
        classesTable.setModel(getClassListTableModel());
        classesTable.setRowHeight(20);
        classesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                if (classesTable.getSelectedRowCount() > 0) {
                    addAsRuleButton.setEnabled(true);
                } else {
                    addAsRuleButton.setEnabled(false);
                }

            }
        });
        TableColumn c = classesTable.getColumnModel().getColumn(0);
        c.setMinWidth(50);
        c.setMaxWidth(50);

        c = classesTable.getColumnModel().getColumn(1);
        c.setMinWidth(300);
        c.setCellRenderer(new DefaultTableCellRenderer() {
            Font f1 = new Font("Tahoma", java.awt.Font.PLAIN, 12);
            Font f2 = new Font("Tahoma", java.awt.Font.BOLD, 12);

            @Override
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                    boolean hasFocus, int row, int column) {
                super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

                if (isSelected) {
                    setFont(f2);
                } else {
                    setFont(f1);
                }
                if (classListTableModel.getRow(row).info.isInstrumented()) {
                    if (isSelected) {
                        setForeground(Color.YELLOW);
                        setBackground(Color.BLUE);
                    } else {
                        setBackground(Color.decode("#bbffbb"));
                        setForeground(Color.BLACK);
                    }
                } else {
                    if (isSelected) {
                        setForeground(Color.WHITE);
                        setBackground(Color.BLUE);
                    } else {
                        setBackground(Color.WHITE);
                        setForeground(Color.BLACK);
                    }
                }
                setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4));
                return this;
            }
        });

    }
    return classesTable;
}

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

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

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

    JFreeChart chart = getChart("summary.chart1", 0);
    CategoryPlot categoryPlot = chart.getCategoryPlot();
    Assert.assertEquals("renderer", StackedBarRenderer3D.class, categoryPlot.getRenderer().getClass());
    BarRenderer3D renderer = (BarRenderer3D) categoryPlot.getRenderer();
    Assert.assertTrue("show labels", renderer.getBaseItemLabelsVisible());
    Assert.assertEquals("x offset", 2d, renderer.getXOffset());
    Assert.assertEquals("y offset", 3d, renderer.getYOffset());

    chart = getChart("summary.chart2", 0);
    Axis axis = chart.getCategoryPlot().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());
    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.chart3", 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.aistor.common.servlet.ValidateCodeServlet.java

private String createCharacter(Graphics g) {
    char[] codeSeq = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S',
            'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
    String[] fontTypes = { "\u5b8b\u4f53", "\u65b0\u5b8b\u4f53", "\u9ed1\u4f53", "\u6977\u4f53",
            "\u96b6\u4e66" };
    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);//from   www .  j av a 2  s.  co  m
    }
    return s.toString();
}

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

public Speedometer(int Vs0, int Vfe, int Vs, int Vno, int Vne, int endScaleKmh) {
    super(null);/* w w  w .j  a v  a2 s.  com*/
    currentGroundSpeedKmh = 0;
    if (!setArcs(Vs0, Vfe, Vs, Vno, Vne, endScaleKmh)) {
        this.Vx = 90;
        this.Vy = 100;
        this.Vs0 = 45;
        this.Vs = 55;
        this.Vfe = 86;
        this.Va = 135;
        this.Vno = 160;
        this.Vne = 180;
        this.endScale = 185;
    }
    groundSpeedDataset = new DefaultValueDataset(0);
    totalSpeedDataset = new DefaultValueDataset(0);
    DialPlot dialplot = new DialPlot();
    dialplot.setDataset(0, groundSpeedDataset);
    dialplot.setDataset(1, totalSpeedDataset);
    StandardDialFrame dialFrame = new StandardDialFrame();
    dialFrame.setBackgroundPaint(Color.lightGray);
    dialFrame.setForegroundPaint(Color.gray);
    DialBackground db = new DialBackground(Color.black);
    dialplot.setBackground(db);
    dialplot.setDialFrame(dialFrame);

    DialTextAnnotation dialtextannotation = new DialTextAnnotation("Km/h");
    dialtextannotation.setFont(new Font("Arial", 1, 14));
    dialtextannotation.setRadius(0.4D);
    dialtextannotation.setPaint(Color.lightGray);
    dialplot.addLayer(dialtextannotation);

    //DialValueIndicator dialvalueindicator = new DialValueIndicator(0);
    //dialplot.addLayer(dialvalueindicator);
    DialValueIndicator groundIndicator = new DialValueIndicator(0);
    groundIndicator.setFont(new Font("Dialog", 0, 10));
    groundIndicator.setOutlinePaint(Color.green);
    groundIndicator.setRadius(0.3);
    groundIndicator.setAngle(-110D);
    dialplot.addLayer(groundIndicator);
    DialValueIndicator realIndicator = new DialValueIndicator(1);
    realIndicator.setFont(new Font("Dialog", 0, 10));
    realIndicator.setOutlinePaint(Color.cyan);
    realIndicator.setRadius(0.3);
    realIndicator.setAngle(-70);
    dialplot.addLayer(realIndicator);
    StandardDialScale scale = new StandardDialScale(0, endScale, 90, -350, 10, 5);
    scale.setFirstTickLabelVisible(true);
    scale.setTickRadius(0.9D);
    scale.setTickLabelOffset(0.14999999999999999D);
    NumberFormat formatter = new DecimalFormat("#");
    scale.setTickLabelFormatter(formatter);
    scale.setTickLabelFont(new Font("Arial", Font.BOLD, 16));
    scale.setMajorTickPaint(Color.white);
    scale.setMinorTickPaint(Color.lightGray);
    scale.setTickLabelPaint(Color.white);
    dialplot.addScale(0, scale);
    dialplot.addPointer(new org.jfree.chart.plot.dial.DialPointer.Pin());
    DialCap dialcap = new DialCap();
    dialcap.setRadius(0.10);
    dialcap.setFillPaint(Color.lightGray);
    dialplot.setCap(dialcap);
    jChart = new JFreeChart(dialplot);
    StandardDialRange standarddialrange = new StandardDialRange(this.Vne, endScale, Color.red);
    standarddialrange.setInnerRadius(0.54D);
    standarddialrange.setOuterRadius(0.56D);
    dialplot.addLayer(standarddialrange);
    StandardDialRange standarddialrange1 = new StandardDialRange(this.Vno, this.Vne, Color.yellow);
    standarddialrange1.setInnerRadius(0.54D);
    standarddialrange1.setOuterRadius(0.56D);
    dialplot.addLayer(standarddialrange1);
    StandardDialRange standarddialrange2 = new StandardDialRange(this.Vs, this.Vno, Color.green);
    standarddialrange2.setInnerRadius(0.54D);
    standarddialrange2.setOuterRadius(0.56D);
    dialplot.addLayer(standarddialrange2);
    StandardDialRange standarddialrange3 = new StandardDialRange(this.Vs0, this.Vfe, Color.white);
    standarddialrange3.setInnerRadius(0.50D);
    standarddialrange3.setOuterRadius(0.52D);
    dialplot.addLayer(standarddialrange3);
    //dialplot.removePointer(0);
    Pointer realPointer = new Pointer(1);
    realPointer.setFillPaint(Color.cyan);
    dialplot.addPointer(realPointer);
    Pointer groundPointer = new Pointer(0);
    groundPointer.setFillPaint(Color.green);
    dialplot.addPointer(groundPointer);

    /* PER NASCONDERE GLI INDICATORI
    groundIndicator.setVisible(false);
    realIndicator.setVisible(false);
    groundPointer.setVisible(false);
    realPointer.setVisible(false);
    */

    super.setChart(jChart);
    super.setPreferredSize(new Dimension(400, 400));
}

From source file:apm.common.servlet.ValidateCodeServlet.java

private String createCharacter(Graphics g) {
    char[] codeSeq = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T',
            'U', 'V', 'W', 'X', 'Y', 'Z', '2', '3', '4', '5', '6', '7', '8', '9' };
    String[] fontTypes = { "\u5b8b\u4f53", "\u65b0\u5b8b\u4f53", "\u9ed1\u4f53", "\u6977\u4f53",
            "\u96b6\u4e66" };
    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  ww.  ja  v a2  s.co  m
    }
    return s.toString();
}

From source file:com.cburch.draw.shapes.SvgReader.java

private static AbstractCanvasObject createText(Element elt) {
    int x = Integer.parseInt(elt.getAttribute("x"));
    int y = Integer.parseInt(elt.getAttribute("y"));
    String text = elt.getTextContent();
    Text ret = new Text(x, y, text);

    String fontFamily = elt.getAttribute("font-family");
    String fontStyle = elt.getAttribute("font-style");
    String fontWeight = elt.getAttribute("font-weight");
    String fontSize = elt.getAttribute("font-size");
    int styleFlags = 0;
    if (fontStyle.equals("italic"))
        styleFlags |= Font.ITALIC;
    if (fontWeight.equals("bold"))
        styleFlags |= Font.BOLD;
    int size = Integer.parseInt(fontSize);
    ret.setValue(DrawAttr.FONT, new Font(fontFamily, styleFlags, size));

    String alignStr = elt.getAttribute("text-anchor");
    AttributeOption halign;//from   w  w w .  ja  va 2s  . c om
    if (alignStr.equals("start")) {
        halign = DrawAttr.ALIGN_LEFT;
    } else if (alignStr.equals("end")) {
        halign = DrawAttr.ALIGN_RIGHT;
    } else {
        halign = DrawAttr.ALIGN_CENTER;
    }
    ret.setValue(DrawAttr.ALIGNMENT, halign);

    // fill color is handled after we return
    return ret;
}