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:virgil.meanback.HistoryInfo.java

public void printChart(Stock stock, List<String[]> list, int days) throws Exception {
    //?//from   ww w . jav  a2s  . c o  m
    StandardChartTheme standardChartTheme = new StandardChartTheme("CN");
    //
    standardChartTheme.setExtraLargeFont(new Font("", Font.BOLD, 20));
    //
    standardChartTheme.setRegularFont(new Font("", Font.BOLD, 12));
    //?
    standardChartTheme.setLargeFont(new Font("", Font.BOLD, 18));
    //?
    ChartFactory.setChartTheme(standardChartTheme);
    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();
    for (int i = list.size() - 1; i >= 0; i--) {
        String[] s = (String[]) list.get(i);
        dataSet.addValue(Double.parseDouble(s[1]), days + "", s[0]);
        dataSet.addValue(Double.parseDouble(stock.getList().get(i).getClose()), "", s[0]);
        float sub = Float.parseFloat(s[2]);
        float error = Float.parseFloat(s[3]);
        if (sub > error * 2) {
            dataSet.addValue(Double.parseDouble(stock.getList().get(i).getClose()), "??", s[0]);
        }
    }

    //?????Legend
    //????
    //??URL
    JFreeChart chart = ChartFactory.createLineChart(
            stock.getName() + "(" + stock.getCode() + ") ", "", "", dataSet,
            PlotOrientation.VERTICAL, true, true, false);
    CategoryPlot cp = chart.getCategoryPlot();
    cp.setBackgroundPaint(ChartColor.WHITE); // 
    CategoryAxis categoryAxis = cp.getDomainAxis();
    //  Lable 90 
    Font labelFont = new Font("SansSerif", Font.TRUETYPE_FONT, 10);
    categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    categoryAxis.setTickLabelFont(labelFont);//X?? 
    ValueAxis yAxis = cp.getRangeAxis();
    yAxis.setAutoRange(true);
    double[] d = getAxiasThresold(stock, list);
    yAxis.setLowerBound(d[0] - 0.15);
    yAxis.setUpperBound(d[1] + 0.15);
    LineAndShapeRenderer lasp = (LineAndShapeRenderer) cp.getRenderer();
    lasp.setBaseFillPaint(ChartColor.RED);
    lasp.setDrawOutlines(true);
    lasp.setSeriesShape(0, new java.awt.geom.Ellipse2D.Double(-5D, -5D, 10D, 10D));
    LineAndShapeRenderer renderer = (LineAndShapeRenderer) cp.getRenderer(1);//?
    DecimalFormat decimalformat1 = new DecimalFormat("##.##");//???
    renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", decimalformat1));
    //????
    renderer.setItemLabelsVisible(true);//
    renderer.setBaseItemLabelsVisible(true);//
    //?????
    renderer.setShapesFilled(Boolean.TRUE);//??
    renderer.setShapesVisible(true);//?
    ChartFrame chartFrame = new ChartFrame("??", chart, true);
    //chart?JavaChartFramejavaJframe????
    chartFrame.pack(); //??
    chartFrame.setVisible(true);//???
}

From source file:fr.gouv.diplomatie.applitutoriel.utility.Graphique.java

/**
 * Creer camember3 d./*from   w w w.j a  v a  2 s.  c om*/
 *
 * @param title
 *            the title
 * @param dataset
 *            the dataset
 * @param legend
 *            the legend
 * @param tooltips
 *            the tooltips
 * @param urls
 *            the urls
 * @return the j free chart
 * @throws FontFormatException
 *             the font format exception
 * @throws IOException
 *             Signals that an I/O exception has occurred.
 */
public static JFreeChart creerCamember3D(final String title, final DefaultPieDataset dataset,
        final boolean legend, final boolean tooltips, final boolean urls)
        throws FontFormatException, IOException {

    dataset.sortByValues(SortOrder.DESCENDING);
    final JFreeChart jfreeChart = ChartFactory.createPieChart3D(title, dataset, legend, tooltips, urls);

    jfreeChart.setBackgroundPaint(Color.white);
    jfreeChart.setBorderVisible(true);
    jfreeChart.getLegend().setPosition(RectangleEdge.LEFT);
    final GraphicsEnvironment graph = GraphicsEnvironment.getLocalGraphicsEnvironment();
    final InputStream inputStream = Thread.currentThread().getContextClassLoader()
            .getResourceAsStream("hornet/framework/font/LiberationSans-Bold.ttf");
    final Font font = Font.createFont(Font.TRUETYPE_FONT, inputStream);
    graph.registerFont(font);
    jfreeChart.getLegend().setItemFont(new Font("Liberation Sans", Font.BOLD, 11));
    jfreeChart.getLegend().setHeight(400);
    jfreeChart.getLegend().setBorder(0, 0, 0, 0);
    jfreeChart.setTitle(new TextTitle(title, new Font("Liberation Sans", Font.BOLD, 16)));
    final PiePlot piePlot = (PiePlot) jfreeChart.getPlot();

    final int nbData = dataset.getItemCount();
    int cptColor = 0;
    for (int x = 0; x < nbData; x++) {
        if (cptColor >= listColor.size()) {
            cptColor = 0;
        }
        piePlot.setSectionPaint(dataset.getKey(x), listColor.get(cptColor));

        cptColor++;

    }

    piePlot.setForegroundAlpha(0.5f);
    piePlot.setLabelFont(new Font("Liberation Sans", Font.BOLD, 12));
    piePlot.setLabelOutlineStroke(null);
    piePlot.setLabelLinkStroke(new BasicStroke(0.4f));
    piePlot.setLabelBackgroundPaint(Color.WHITE);
    piePlot.setLabelLinkStyle(PieLabelLinkStyle.STANDARD);
    piePlot.setBackgroundAlpha(0);
    piePlot.setOutlineVisible(false);
    piePlot.setForegroundAlpha(1); // transparence
    piePlot.setInteriorGap(0); // le camembert occupe plus de place
    piePlot.setLabelGenerator(new StandardPieSectionLabelGenerator("{1}"));
    piePlot.setStartAngle(70);
    piePlot.setCircular(true); // force pour avoir un cercle et pas un oval
    piePlot.setMaximumLabelWidth(0.20);
    piePlot.setBaseSectionOutlinePaint(Color.BLACK); // bordure du camembert

    return jfreeChart;

}

From source file:eu.europeana.sip.gui.SipCreatorGUI.java

public SipCreatorGUI() throws FileStoreException {
    super("Delving SIP Creator");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    MetadataModel metadataModel = loadMetadataModel();
    File fileStoreDirectory = getFileStoreDirectory();
    FileStore fileStore = new FileStoreImpl(fileStoreDirectory, metadataModel);
    GroovyCodeResource groovyCodeResource = new GroovyCodeResource();
    this.dataSetListModel = new DataSetListModel(new DataSetListModel.ConnectedStatus() {
        @Override//from  w  w  w . j a  v a  2 s. c  om
        public boolean isConnected() {
            return connectedBox.isSelected();
        }
    });
    this.dataSetList = new JList(dataSetListModel);
    this.sipModel = new SipModel(fileStore, metadataModel, groovyCodeResource, new PopupExceptionHandler());
    this.dataSetClient = new DataSetClient(new DataSetClient.Context() {

        @Override
        public String getServerUrl() {
            return sipModel.getAppConfigModel().getServerUrl();
        }

        @Override
        public String getAccessKey() {
            return sipModel.getAppConfigModel().getAccessKey();
        }

        @Override
        public void setInfo(DataSetInfo dataSetInfo) {
            dataSetListModel.setDataSetInfo(dataSetInfo);
            dataSetActions.setDataSetInfo(dataSetInfo);
        }

        @Override
        public void setList(List<DataSetInfo> list) {
            if (list != null) {
                Set<String> untouched = dataSetListModel.setDataSetInfoList(list);
                if (!untouched.isEmpty()) {
                    dataSetActions.setUntouched(untouched);
                }
                for (DataSetInfo dataSetInfo : list) {
                    dataSetActions.setDataSetInfo(dataSetInfo);
                }
            } else {
                log.warn("received empty list from the server");
            }
        }

        @Override
        public void tellUser(String message) {
            sipModel.getUserNotifier().tellUser(message);
        }

        @Override
        public void disconnected() {
            connectedBox.setSelected(false);
            sipModel.getUserNotifier().tellUser(String.format("Disconnected from Repository at %s",
                    sipModel.getAppConfigModel().getServerHostPort()));
        }
    });
    dataSetActions = new DataSetActions(this, sipModel, dataSetClient, new Runnable() {
        @Override
        public void run() {
            dataSetListModel.clear();
            for (FileStore.DataSetStore dataSetStore : sipModel.getFileStore().getDataSetStores().values()) {
                dataSetListModel.setDataSetStore(dataSetStore);
            }
            dataSetListModel.setPattern(filter.getText());
        }
    });
    setJMenuBar(createMenuBar());
    JPanel main = new JPanel(new BorderLayout(MARGIN, MARGIN));
    main.setBorder(BorderFactory.createEmptyBorder(MARGIN, MARGIN, MARGIN, MARGIN));
    JPanel north = new JPanel(new BorderLayout());
    north.setBorder(
            BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(MARGIN, MARGIN, 0, MARGIN),
                    BorderFactory.createRaisedBevelBorder()));
    titleLabel.setOpaque(true);
    titleLabel.setFont(new Font("Sans", Font.BOLD, 24));
    JLabel northRight = new JLabel(new ImageIcon(getClass().getResource("/delving-logo.png")));
    north.add(createFilterPanel(), BorderLayout.WEST);
    north.add(titleLabel, BorderLayout.CENTER);
    north.add(northRight, BorderLayout.EAST);
    getContentPane().add(north, BorderLayout.NORTH);
    getContentPane().add(main, BorderLayout.CENTER);
    JPanel south = new JPanel(new GridLayout(1, 0));
    south.add(createConnectPanel());
    south.add(createFinishedPanel());
    getContentPane().add(south, BorderLayout.SOUTH);
    main.add(createList(), BorderLayout.CENTER);
    main.add(dataSetActions.getPanel(), BorderLayout.EAST);
    setSize(SIZE);
    setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - SIZE.width) / 2,
            (Toolkit.getDefaultToolkit().getScreenSize().height - SIZE.height) / 2);
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            for (FileStore.DataSetStore dataSetStore : sipModel.getFileStore().getDataSetStores().values()) {
                dataSetListModel.setDataSetStore(dataSetStore);
            }
        }
    });
}

From source file:com.univocity.app.swing.DataAnalysisWindow.java

protected JLabel getStatusLabel() {
    if (statusLabel == null) {
        statusLabel = new JLabel();
        statusLabel.setFont(new Font("Arial", Font.BOLD, 10));
    }/*from  w  w  w  .  ja v  a2 s. c  o  m*/
    return statusLabel;
}

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);// www .  jav  a2s  .  c o 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.yccheok.jstock.gui.charting.ChartLayerUI.java

private void drawInformationBox(Graphics2D g2, JXLayer<? extends V> layer) {
    if (JStock.instance().getJStockOptions()
            .getYellowInformationBoxOption() == JStockOptions.YellowInformationBoxOption.Hide) {
        return;/*from   w  w  w.j ava2 s .c  om*/
    }

    final Font oldFont = g2.getFont();
    final Font paramFont = oldFont;
    final FontMetrics paramFontMetrics = g2.getFontMetrics(paramFont);
    final Font valueFont = oldFont.deriveFont(oldFont.getStyle() | Font.BOLD, (float) oldFont.getSize() + 1);
    final FontMetrics valueFontMetrics = g2.getFontMetrics(valueFont);
    final Font dateFont = oldFont.deriveFont((float) oldFont.getSize() - 1);
    final FontMetrics dateFontMetrics = g2.getFontMetrics(dateFont);

    final List<ChartData> chartDatas = this.chartJDialog.getChartDatas();
    List<String> values = new ArrayList<String>();
    final ChartData chartData = chartDatas.get(this.mainTraceInfo.getDataIndex());

    // Number formats are generally not synchronized. It is recommended to create separate format instances for each thread. 
    // If multiple threads access a format concurrently, it must be synchronized externally.
    // http://stackoverflow.com/questions/2213410/usage-of-decimalformat-for-the-following-case
    final DecimalFormat integerFormat = new DecimalFormat("###,###");

    // It is common to use OHLC for chat, instead of using PrevPrice.        
    values.add(org.yccheok.jstock.gui.Utils.stockPriceDecimalFormat(chartData.openPrice));
    values.add(org.yccheok.jstock.gui.Utils.stockPriceDecimalFormat(chartData.highPrice));
    values.add(org.yccheok.jstock.gui.Utils.stockPriceDecimalFormat(chartData.lowPrice));
    values.add(org.yccheok.jstock.gui.Utils.stockPriceDecimalFormat(chartData.lastPrice));
    values.add(integerFormat.format(chartData.volume));

    final List<String> indicatorParams = new ArrayList<String>();
    final List<String> indicatorValues = new ArrayList<String>();
    final DecimalFormat decimalFormat = new DecimalFormat("0.00");
    for (TraceInfo indicatorTraceInfo : this.indicatorTraceInfos) {
        final int plotIndex = indicatorTraceInfo.getPlotIndex();
        final int seriesIndex = indicatorTraceInfo.getSeriesIndex();
        final int dataIndex = indicatorTraceInfo.getDataIndex();
        final String name = this.getLegendName(plotIndex, seriesIndex);
        final Number value = this.getValue(plotIndex, seriesIndex, dataIndex);
        if (name == null || value == null) {
            continue;
        }
        indicatorParams.add(name);
        indicatorValues.add(decimalFormat.format(value));
    }

    assert (values.size() == params.size());
    int index = 0;
    final int paramValueWidthMargin = 10;
    final int paramValueHeightMargin = 0;
    // Slightly larger than dateInfoHeightMargin, as font for indicator is
    // larger than date's.
    final int infoIndicatorHeightMargin = 8;
    int maxInfoWidth = -1;
    // paramFontMetrics will always "smaller" than valueFontMetrics.
    int totalInfoHeight = Math.max(paramFontMetrics.getHeight(), valueFontMetrics.getHeight()) * values.size()
            + paramValueHeightMargin * (values.size() - 1);
    for (String param : params) {
        final String value = values.get(index++);
        final int paramStringWidth = paramFontMetrics.stringWidth(param + ":") + paramValueWidthMargin
                + valueFontMetrics.stringWidth(value);
        if (maxInfoWidth < paramStringWidth) {
            maxInfoWidth = paramStringWidth;
        }
    }

    if (indicatorValues.size() > 0) {
        totalInfoHeight += infoIndicatorHeightMargin;
        totalInfoHeight += Math.max(paramFontMetrics.getHeight(), valueFontMetrics.getHeight())
                * indicatorValues.size() + paramValueHeightMargin * (indicatorValues.size() - 1);
        index = 0;
        for (String indicatorParam : indicatorParams) {
            final String indicatorValue = indicatorValues.get(index++);
            final int paramStringWidth = paramFontMetrics.stringWidth(indicatorParam + ":")
                    + paramValueWidthMargin + valueFontMetrics.stringWidth(indicatorValue);
            if (maxInfoWidth < paramStringWidth) {
                maxInfoWidth = paramStringWidth;
            }
        }
    }

    final Date date = new Date(chartData.timestamp);

    // Date formats are not synchronized. It is recommended to create separate format instances for each thread.
    // If multiple threads access a format concurrently, it must be synchronized externally.
    final SimpleDateFormat simpleDateFormat = this.simpleDataFormatThreadLocal.get();
    final String dateString = simpleDateFormat.format(date);
    final int dateStringWidth = dateFontMetrics.stringWidth(dateString);
    final int dateStringHeight = dateFontMetrics.getHeight();
    // We want to avoid information box from keep changing its width while
    // user moves along the mouse. This will prevent user from feeling,
    // information box is flickering, which is uncomfortable to user's eye.
    final int maxStringWidth = Math.max(dateFontMetrics.stringWidth(longDateString),
            Math.max(this.maxWidth, Math.max(dateStringWidth, maxInfoWidth)));
    if (maxStringWidth > this.maxWidth) {
        this.maxWidth = maxStringWidth;
    }
    final int dateInfoHeightMargin = 5;
    final int maxStringHeight = dateStringHeight + dateInfoHeightMargin + totalInfoHeight;

    final int padding = 5;
    final int boxPointMargin = 8;
    final int width = maxStringWidth + (padding << 1);
    final int height = maxStringHeight + (padding << 1);

    /* Get Border Rect Information. */
    /*
    fillRect(1, 1, 1, 1);   // O is rect pixel
            
    xxx
    xOx
    xxx
            
    drawRect(0, 0, 2, 2);   // O is rect pixel
            
    OOO
    OxO
    OOO
     */
    final int borderWidth = width + 2;
    final int borderHeight = height + 2;
    // On left side of the ball.
    final double suggestedBorderX = this.mainTraceInfo.getPoint().getX() - borderWidth - boxPointMargin;
    final double suggestedBorderY = this.mainTraceInfo.getPoint().getY() - (borderHeight >> 1);
    double bestBorderX = 0;
    double bestBorderY = 0;
    if (JStock.instance().getJStockOptions()
            .getYellowInformationBoxOption() == JStockOptions.YellowInformationBoxOption.Stay) {
        if (this.mainTraceInfo.getPoint()
                .getX() > ((int) (this.mainDrawArea.getX() + this.mainDrawArea.getWidth() + 0.5) >> 1)) {
            bestBorderX = this.mainDrawArea.getX();
            bestBorderY = this.mainDrawArea.getY();
        } else {
            bestBorderX = this.mainDrawArea.getX() + this.mainDrawArea.getWidth() - borderWidth;
            bestBorderY = this.mainDrawArea.getY();
        }
    } else {
        assert (JStock.instance().getJStockOptions()
                .getYellowInformationBoxOption() == JStockOptions.YellowInformationBoxOption.Follow);
        bestBorderX = suggestedBorderX > this.mainDrawArea.getX()
                ? (suggestedBorderX + borderWidth) < (this.mainDrawArea.getX() + this.mainDrawArea.getWidth())
                        ? suggestedBorderX
                        : this.mainDrawArea.getX() + this.mainDrawArea.getWidth() - borderWidth - boxPointMargin
                : this.mainTraceInfo.getPoint().getX() + boxPointMargin;
        bestBorderY = suggestedBorderY > this.mainDrawArea.getY()
                ? (suggestedBorderY + borderHeight) < (this.mainDrawArea.getY() + this.mainDrawArea.getHeight())
                        ? suggestedBorderY
                        : this.mainDrawArea.getY() + this.mainDrawArea.getHeight() - borderHeight
                                - boxPointMargin
                : this.mainDrawArea.getY() + boxPointMargin;
    }

    final double x = bestBorderX + 1;
    final double y = bestBorderY + 1;

    final Object oldValueAntiAlias = g2.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
    final Composite oldComposite = g2.getComposite();
    final Color oldColor = g2.getColor();

    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setColor(COLOR_BORDER);
    g2.drawRoundRect((int) (bestBorderX + 0.5), (int) (bestBorderY + 0.5), borderWidth - 1, borderHeight - 1,
            15, 15);
    g2.setColor(COLOR_BACKGROUND);
    g2.setComposite(Utils.makeComposite(0.75f));
    g2.fillRoundRect((int) (x + 0.5), (int) (y + 0.5), width, height, 15, 15);
    g2.setComposite(oldComposite);
    g2.setColor(oldColor);

    int yy = (int) (y + padding + dateFontMetrics.getAscent() + 0.5);
    g2.setFont(dateFont);
    g2.setColor(COLOR_BLUE);
    g2.drawString(dateString, (int) (((width - dateFontMetrics.stringWidth(dateString)) >> 1) + x + 0.5), yy);

    index = 0;
    yy += dateFontMetrics.getDescent() + dateInfoHeightMargin + valueFontMetrics.getAscent();
    final String CLOSE_STR = GUIBundle.getString("StockHistory_Close");
    for (String param : params) {
        final String value = values.get(index++);
        g2.setColor(Color.BLACK);
        if (param.equals(CLOSE_STR)) {
            // It is common to use OHLC for chat, instead of using PrevPrice.
            final double changePrice = chartData.lastPrice - chartData.openPrice;
            if (changePrice > 0.0) {
                g2.setColor(JStockOptions.DEFAULT_HIGHER_NUMERICAL_VALUE_FOREGROUND_COLOR);
            } else if (changePrice < 0.0) {
                g2.setColor(JStockOptions.DEFAULT_LOWER_NUMERICAL_VALUE_FOREGROUND_COLOR);
            }
        }
        g2.setFont(paramFont);
        g2.drawString(param + ":", (int) (padding + x + 0.5), yy);
        g2.setFont(valueFont);
        g2.drawString(value, (int) (width - padding - valueFontMetrics.stringWidth(value) + x + 0.5), yy);
        // Same as yy += valueFontMetrics.getDescent() + paramValueHeightMargin + valueFontMetrics.getAscent()
        yy += paramValueHeightMargin + valueFontMetrics.getHeight();
    }

    g2.setColor(Color.BLACK);
    yy -= paramValueHeightMargin;
    yy += infoIndicatorHeightMargin;

    index = 0;
    for (String indicatorParam : indicatorParams) {
        final String indicatorValue = indicatorValues.get(index++);
        g2.setFont(paramFont);
        g2.drawString(indicatorParam + ":", (int) (padding + x + 0.5), yy);
        g2.setFont(valueFont);
        g2.drawString(indicatorValue,
                (int) (width - padding - valueFontMetrics.stringWidth(indicatorValue) + x + 0.5), yy);
        // Same as yy += valueFontMetrics.getDescent() + paramValueHeightMargin + valueFontMetrics.getAscent()
        yy += paramValueHeightMargin + valueFontMetrics.getHeight();
    }

    g2.setColor(oldColor);
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldValueAntiAlias);
    g2.setFont(oldFont);
}

From source file:com.sec.ose.osi.ui.frm.main.identification.JPanIdentifyResetComment.java

/**
 * This method initializes jScrollPane1   
 *    // w  ww  .j a v  a  2 s.  co m
 * @return javax.swing.JScrollPane   
 */
private JScrollPane getJScrollPaneComment() {
    if (jScrollPaneComment == null) {
        jScrollPaneComment = new JScrollPane();
        jScrollPaneComment.setBorder(BorderFactory.createTitledBorder(null, "File Comment",
                TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
                new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
        jScrollPaneComment.setViewportView(getJTextAreaComment());
    }
    return jScrollPaneComment;
}

From source file:edu.scripps.fl.pubchem.xmltool.gui.GUIComponent.java

public JLabel createJLabel(String name) {
    Font jlbFont = new Font(Font.SANS_SERIF, Font.BOLD, 12);
    JLabel jlb = new JLabel(name);
    jlb.setFont(jlbFont);/*from w w  w . jav a 2s  .  com*/
    return jlb;
}

From source file:ColumnLayout.java

public ColumnLayoutPane() {
    // Get rid of the default layout manager.
    // We'll arrange the components ourselves.
    this.setLayout(new ColumnLayout(5, 5, 10, ColumnLayout.RIGHT));

    // Create some buttons and set their sizes and positions explicitly
    for (int i = 0; i < 6; i++) {
        int pointsize = 8 + i * 2;
        JButton b = new JButton("Point size " + pointsize);
        b.setFont(new Font("helvetica", Font.BOLD, pointsize));
        this.add(b);
    }// w w w  .  ja  v  a  2  s .  co  m
}

From source file:org.pmedv.core.dialogs.AbstractNiceDialog.java

private JPanel createHeader(String title, String subTitle, ImageIcon icon) {

    int headerHeight = 50;

    FormLayout formLayout = new FormLayout("8dlu, 10dlu, fill:pref:grow, 7dlu, pref, 7dlu",
            "4dlu, 13dlu,max(" + (headerHeight - 17) + "dlu;default),default");

    // GradientPanel header = new GradientPanel(formLayout,Color.WHITE,Color.LIGHT_GRAY);

    Color blue = new Color(153, 204, 255);
    GradientPanel header = new GradientPanel(formLayout, Color.WHITE, blue);
    header.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
    header.setBackground(Color.white);

    JLabel titleLabel = new JLabel(title);
    JLabel subTitleLabel = new JLabel(subTitle);
    JLabel iconLabel = (icon == null ? new JLabel() : new JLabel(icon));

    titleLabel.setForeground(Color.black);
    subTitleLabel.setForeground(Color.black);

    titleLabel.setFont(new Font("Arial", Font.BOLD, 15));
    subTitleLabel.setFont(new Font("Arial", Font.PLAIN, 12));

    CellConstraints cc = new CellConstraints();
    header.add(titleLabel, cc.xywh(2, 2, 2, 1));
    header.add(subTitleLabel, cc.xywh(2, 3, 2, 1));
    header.add(iconLabel, cc.xywh(5, 1, 1, 3, "right,center"));

    return (header);

}