Example usage for java.awt Font PLAIN

List of usage examples for java.awt Font PLAIN

Introduction

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

Prototype

int PLAIN

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

Click Source Link

Document

The plain style constant.

Usage

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

/**
 * Creates a chart./* w  w w.  j  a va 2  s.  c  om*/
 *
 * @param dataset the dataset.
 *
 * @return A chart.
 */
private JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart(title, // chart title
            dataset, // data
            true, // no legend
            true, // tooltips
            false // no URL generation
    );

    // set a custom background for the chart
    chart.setBackgroundPaint(
            new GradientPaint(new Point(0, 0), new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY));

    // customise the title position and font
    TextTitle t = chart.getTitle();
    t.setHorizontalAlignment(HorizontalAlignment.LEFT);
    t.setPaint(new Color(240, 240, 240));
    t.setFont(new Font("Arial", Font.BOLD, 26));

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.04);
    plot.setOutlineVisible(false);

    // use gradients and white borders for the section colours
    int itemIndex = 0;
    for (Object col : pieDataset.getKeys()) {
        plot.setSectionPaint(col.toString(), gradientPaints[itemIndex]);
        if (itemIndex == pieDataset.getItemCount() - 1) {
            itemIndex = 0;
        }
        itemIndex++;
    }

    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

    // customise the section label appearance
    plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
    plot.setLabelLinkPaint(Color.WHITE);
    plot.setLabelLinkStroke(new BasicStroke(2.0f));
    plot.setLabelOutlineStroke(null);
    plot.setLabelPaint(Color.WHITE);
    plot.setLabelBackgroundPaint(null);

    // add a subtitle giving the data source
    TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523",
            new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    return chart;

}

From source file:ca.sqlpower.wabit.swingui.report.selectors.FancyTextBoxSelectorField.java

public FancyTextBoxSelectorField(final TextBoxSelector selector, Runnable refreshRoutine) {

    this.selector = selector;
    this.refreshRoutine = refreshRoutine;
    this.addFocusListener(focusListener);
    this.addKeyListener(this.enterKeyListener);
    this.selector.addSPListener(spListener);

    setText(selector.getCurrentValue() == null ? null : selector.getCurrentValue().toString());

    if (getText().length() == 0 || ObjectUtils.equals(getText(), selector.getDefaultValue())) {
        setText(selector.getDefaultValue() == null ? null : selector.getDefaultValue().toString());
        setForeground(Color.GRAY);
        setFont(getFont().deriveFont(Font.ITALIC));
    } else {/* w w  w.ja  v a  2  s  .  c  om*/
        setForeground(Color.BLACK);
        setFont(getFont().deriveFont(Font.PLAIN));
    }
}

From source file:AccessibleScrollDemo.java

public AccessibleScrollDemo() {
    //Load the photograph into an image icon.
    ImageIcon david = new ImageIcon("images/youngdad.jpeg");
    david.setDescription("Photograph of David McNabb in his youth.");

    //Create the row and column headers
    columnView = new Rule(Rule.HORIZONTAL, true);
    columnView.setPreferredWidth(david.getIconWidth());
    columnView.getAccessibleContext().setAccessibleName("Column Header");
    columnView.getAccessibleContext()/*from  w w w.  j a  va 2 s.c  o  m*/
            .setAccessibleDescription("Displays horizontal ruler for " + "measuring scroll pane client.");
    rowView = new Rule(Rule.VERTICAL, true);
    rowView.setPreferredHeight(david.getIconHeight());
    rowView.getAccessibleContext().setAccessibleName("Row Header");
    rowView.getAccessibleContext()
            .setAccessibleDescription("Displays vertical ruler for " + "measuring scroll pane client.");

    //Create the corners
    JPanel buttonCorner = new JPanel();
    isMetric = new JToggleButton("cm", true);
    isMetric.setFont(new Font("SansSerif", Font.PLAIN, 11));
    isMetric.setMargin(new Insets(2, 2, 2, 2));
    isMetric.addItemListener(new UnitsListener());
    isMetric.setToolTipText("Toggles rulers' unit of measure " + "between inches and centimeters.");
    buttonCorner.add(isMetric); //Use the default FlowLayout
    buttonCorner.getAccessibleContext().setAccessibleName("Upper Left Corner");

    String desc = "Fills the corner of a scroll pane " + "with color for aesthetic reasons.";
    Corner lowerLeft = new Corner();
    lowerLeft.getAccessibleContext().setAccessibleName("Lower Left Corner");
    lowerLeft.getAccessibleContext().setAccessibleDescription(desc);

    Corner upperRight = new Corner();
    upperRight.getAccessibleContext().setAccessibleName("Upper Right Corner");
    upperRight.getAccessibleContext().setAccessibleDescription(desc);

    //Set up the scroll pane
    picture = new ScrollablePicture(david, columnView.getIncrement());
    picture.setToolTipText(david.getDescription());
    picture.getAccessibleContext().setAccessibleName("Scroll pane client");

    JScrollPane pictureScrollPane = new JScrollPane(picture);
    pictureScrollPane.setPreferredSize(new Dimension(300, 250));
    pictureScrollPane.setViewportBorder(BorderFactory.createLineBorder(Color.black));

    pictureScrollPane.setColumnHeaderView(columnView);
    pictureScrollPane.setRowHeaderView(rowView);

    pictureScrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, buttonCorner);
    pictureScrollPane.setCorner(JScrollPane.LOWER_LEFT_CORNER, lowerLeft);
    pictureScrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, upperRight);

    //Put it in this panel
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    add(pictureScrollPane);
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
}

From source file:org.webcat.grader.graphs.WCChartTheme.java

/**
 * Gets a small font appropriate to display numbers along axes.
 *
 * @return a small font/*from   w  w  w. j a va 2 s .  c o  m*/
 */
public Font smallFont() {
    if (smallFont == null) {
        smallFont = new Font(defaultFontName(), Font.PLAIN, 10);
    }

    return smallFont;
}

From source file:com.glaf.chart.util.ChartUtils.java

public static void setChartTheme(Chart chartModel) {
    // ?/*w  w w  .  j  a v a2  s.  c o  m*/
    StandardChartTheme standardChartTheme = new StandardChartTheme("cn");
    // 
    if (chartModel.getChartTitleFont() != null && chartModel.getChartTitleFontSize() != null
            && chartModel.getChartTitleFontSize() > 0) {
        standardChartTheme.setExtraLargeFont(
                new Font(chartModel.getChartTitleFont(), Font.BOLD, chartModel.getChartTitleFontSize()));
    } else {
        standardChartTheme.setExtraLargeFont(new Font("", Font.BOLD, 18));
    }
    if (chartModel.getChartFont() != null && chartModel.getChartFontSize() > 0) {
        // 
        standardChartTheme
                .setRegularFont(new Font(chartModel.getChartFont(), Font.PLAIN, chartModel.getChartFontSize()));
        // ?
        standardChartTheme
                .setLargeFont(new Font(chartModel.getChartFont(), Font.PLAIN, chartModel.getChartFontSize()));
    } else {
        // 
        standardChartTheme.setRegularFont(new Font("", Font.PLAIN, 14));
        // ?
        standardChartTheme.setLargeFont(new Font("", Font.PLAIN, 14));
    }
    // ?
    ChartFactory.setChartTheme(standardChartTheme);
}

From source file:edu.harvard.i2b2.query.ui.TopPanel.java

/** Creates new form QueryTopPanel */
public TopPanel(QueryPanel parent) {
    parentPanel = parent;/*from   w  w w  .  j a  va  2  s  . c om*/
    dataModel = parent.dataModel();

    UIManager.put("Label.font", new Font("Tahoma", Font.PLAIN, 11));

    UIManager.put("Button.font", new Font("Tahoma", Font.PLAIN, 11));

    UIManager.put("TextField.font", new Font("Tahoma", Font.PLAIN, 11));

    UIManager.put("CheckBox.font", new Font("Tahoma", Font.PLAIN, 11));

    UIManager.put("RadioButton.font", new Font("Tahoma", Font.PLAIN, 11));

    UIManager.put("Tree.font", new Font("Tahoma", Font.PLAIN, 11));

    UIManager.put("ComboBox.font", new Font("Tahoma", Font.PLAIN, 11));

    initComponents();
    // jGetPatientCountCheckBox.setSelected(true);
    // jShowTimelineCheckBox.setSelected(true);

    addComponentListener(new java.awt.event.ComponentAdapter() {
        @Override
        public void componentMoved(java.awt.event.ComponentEvent evt) {
            // formComponentMoved(evt);
        }

        @Override
        public void componentResized(java.awt.event.ComponentEvent evt) {
            // formComponentResized(evt);
            // System.out.println("waiting panel resizing ...");
            int width = (getParent().getWidth());
            int height = (getParent().getHeight());
            if (width < 5 || height < 5) {
                return;
            }

            resizePanels(width, height);
            // log.info("width: "+width+", height: "+height);

            if (firsttime) {
                firsttime = false;
                resizePanels(width, height + 3);
                // log.info("second width: "+width+", height: "+(height+3));
            }
        }
    });
}

From source file:org.sonar.plugins.abacus.chart.BarChart3D.java

private Font getFont(String fontSize) {
    int size = FONT_SIZE;
    if (!StringUtils.isBlank(fontSize)) {
        size = Integer.parseInt(fontSize);
    }/*from w  w  w .java2 s.co m*/
    return new Font("SansSerif", Font.PLAIN, size);
}

From source file:org.matsim.pt.counts.obsolete.PtBiasErrorGraph.java

@Override
@Deprecated // use standard counts package
public JFreeChart createChart(final int nbr) {
    DefaultCategoryDataset dataset0 = new DefaultCategoryDataset();
    DefaultCategoryDataset dataset1 = new DefaultCategoryDataset();

    this.errorStats = new ComparisonErrorStatsCalculator(this.ccl_);

    double[] meanRelError = errorStats.getMeanRelError();
    // double[] meanAbsError = errorStats.getMeanAbsError();
    double[] meanAbsBias = errorStats.getMeanAbsBias();

    for (int h = 0; h < 24; h++) {
        dataset0.addValue(meanRelError[h], "Mean rel error", Integer.toString(h + 1));
        // dataset1.addValue(meanAbsError[h], "Mean abs error",
        // Integer.toString(h + 1));
        dataset1.addValue(meanAbsBias[h], "Mean abs bias", Integer.toString(h + 1));
    }//  w  ww  . java  2s . c  o  m

    this.chart_ = ChartFactory.createLineChart(this.chartTitle, "Hour", "Mean rel error [%]", dataset0,
            PlotOrientation.VERTICAL, true, // legend?
            true, // tooltips?
            false // URLs?
    );
    CategoryPlot plot = this.chart_.getCategoryPlot();
    plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
    plot.setDataset(1, dataset1);
    plot.mapDatasetToRangeAxis(1, 1);

    final LineAndShapeRenderer renderer = new LineAndShapeRenderer();
    renderer.setSeriesToolTipGenerator(0, new StandardCategoryToolTipGenerator());
    plot.setRenderer(0, renderer);

    final CategoryAxis axis1 = new CategoryAxis("Hour");
    axis1.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 7));
    plot.setDomainAxis(axis1);

    // final ValueAxis axis2 = new
    // NumberAxis("Mean abs {bias, error} [veh/h]");
    final ValueAxis axis2 = new NumberAxis("Mean abs bias [veh/h]");
    plot.setRangeAxis(1, axis2);

    final ValueAxis axis3 = plot.getRangeAxis(0);
    axis3.setRange(0.0, 100.0);

    final LineAndShapeRenderer renderer2 = new LineAndShapeRenderer();
    renderer2.setSeriesToolTipGenerator(0, new StandardCategoryToolTipGenerator());
    renderer2.setSeriesToolTipGenerator(1, new StandardCategoryToolTipGenerator());
    // renderer2.setSeriesPaint(0, Color.black);
    plot.setRenderer(1, renderer2);
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE);

    return this.chart_;
}

From source file:io.github.tavernaextras.biocatalogue.integration.config.BioCataloguePluginConfigurationPanel.java

private void initialiseUI() {
    this.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.weightx = 1.0;/*  ww  w.j  a v  a  2 s  .  c o m*/

    c.gridx = 0;
    c.gridy = 0;
    JTextArea taDescription = new JTextArea("Configure the Service Catalogue integration functionality");
    taDescription.setFont(taDescription.getFont().deriveFont(Font.PLAIN, 11));
    taDescription.setLineWrap(true);
    taDescription.setWrapStyleWord(true);
    taDescription.setEditable(false);
    taDescription.setFocusable(false);
    taDescription.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    this.add(taDescription, c);

    c.gridy++;
    c.insets = new Insets(20, 0, 0, 0);
    JLabel jlBioCatalogueAPIBaseURL = new JLabel("Base URL of the Service Catalogue instance to connect to:");
    this.add(jlBioCatalogueAPIBaseURL, c);

    c.gridy++;
    c.insets = new Insets(0, 0, 0, 0);
    tfBioCatalogueAPIBaseURL = new JTextField();
    this.add(tfBioCatalogueAPIBaseURL, c);

    c.gridy++;
    c.insets = new Insets(30, 0, 0, 0);
    // We are not removing BioCatalogue services from its config panel any more - 
    // they are being handled by the Taverna's Service Registry
    //    JButton bForgetStoredServices = new JButton("Forget services added to Service Panel by BioCatalogue Plugin");
    //    bForgetStoredServices.addActionListener(new ActionListener() {
    //      public void actionPerformed(ActionEvent e)
    //      {
    //        int response = JOptionPane.showConfirmDialog(null, // no way T2ConfigurationFrame instance can be obtained to be used as a parent...
    //                                       "Are you sure you want to clear all SOAP operations and REST methods\n" +
    //                                       "that were added to the Service Panel by the BioCatalogue Plugin?\n\n" +
    //                                       "This action is permanent is cannot be undone.\n\n" +
    //                                       "Do you want to proceed?", "BioCatalogue Plugin", JOptionPane.YES_NO_OPTION);
    //        
    //        if (response == JOptionPane.YES_OPTION)
    //        {
    //          BioCatalogueServiceProvider.clearRegisteredServices();
    //          JOptionPane.showMessageDialog(null,  // no way T2ConfigurationFrame instance can be obtained to be used as a parent...
    //                          "Stored services have been successfully cleared, but will remain\n" +
    //                          "being shown in Service Panel during this session.\n\n" +
    //                          "They will not appear in the Service Panel after you restart Taverna.",
    //                          "BioCatalogue Plugin", JOptionPane.INFORMATION_MESSAGE);
    //        }
    //      }
    //    });
    //    this.add(bForgetStoredServices, c);

    JButton bLoadDefaults = new JButton("Load Defaults");
    bLoadDefaults.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            loadDefaults();
        }
    });

    JButton bReset = new JButton("Reset");
    bReset.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            resetFields();
        }
    });

    JButton bApply = new JButton("Apply");
    bApply.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            applyChanges();
        }
    });

    JPanel jpActionButtons = new JPanel();
    jpActionButtons.add(bLoadDefaults);
    jpActionButtons.add(bReset);
    jpActionButtons.add(bApply);
    c.insets = new Insets(30, 0, 0, 0);
    c.gridy++;
    c.weighty = 1.0;
    this.add(jpActionButtons, c);
}

From source file:com.bdb.weather.display.current.Thermometer.java

private ChartViewer createChartElements() {
    thermometerPlot/*from w w  w.  j  av  a 2 s  .  c o m*/
            .setMercuryPaint(new GradientPaint(0.0f, 0.0f, Color.RED.darker(), 5.0f, 5.0f, Color.RED, true));
    thermometerPlot.setUseSubrangePaint(false);
    thermometerPlot.setBulbRadius(15);
    thermometerPlot.setColumnRadius(10);
    thermometerPlot.setValueLocation(ThermometerPlot.RIGHT);
    thermometerPlot.setValuePaint(Color.BLACK);
    thermometerPlot.setSubrange(0, 80.0, 80.0);
    thermometerPlot.setSubrangePaint(0, Color.BLUE);
    thermometerPlot.setSubrangePaint(1, Color.RED);
    thermometerPlot.setSubrange(1, 1000.0, 1000.0);
    thermometerPlot.setSubrange(2, 1000.0, 1000.0);
    thermometerPlot.setBackgroundPaint(Color.GRAY);
    thermometerPlot.setOutlineVisible(false);
    thermometerPlot.setValueFont(thermometerPlot.getValueFont().deriveFont(14.0F).deriveFont(Font.PLAIN));

    chart = new JFreeChart(thermometerPlot);
    chart.setTitle(titleProperty.getValue());
    chart.setBackgroundPaint(Color.GRAY);

    ChartViewer chartViewer = new ChartViewer(chart);
    chartViewer.setMinHeight(75);
    chartViewer.setMinWidth(25);
    return chartViewer;
}