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:Main.java

/**
 * Creates a new <code>JTextPane</code> object with the given properties.
 *
 * @param text The text which will appear in the text pane
 * @param backgroundColor The background color
 * @return A <code>JTextPane</code> object
 *//*w  w w  . java  2  s.  c om*/
public static JTextPane createJTextPane(String text, Color backgroundColor) {
    JTextPane jTextPane = new JTextPane();
    jTextPane.setBorder(null);
    jTextPane.setEditable(false);
    jTextPane.setBackground(backgroundColor);
    jTextPane.setFont(new Font("Times New Roman", Font.PLAIN, 14));
    if (text != null) {
        jTextPane.setText(text);
    }
    jTextPane.setVerifyInputWhenFocusTarget(false);
    jTextPane.setAutoscrolls(false);
    return jTextPane;
}

From source file:Main.java

public static Font getFont(String name) {
    Font font = null;//from w  w w .j  av  a  2s  .  c  om
    if (cache != null) {
        if ((font = cache.get(name)) != null) {
            return font;
        }
    }
    String fName = "/fonts/" + name;
    try {
        InputStream is = Main.class.getResourceAsStream(fName);
        font = Font.createFont(Font.TRUETYPE_FONT, is);
    } catch (Exception ex) {
        ex.printStackTrace();
        System.err.println(fName + " not loaded.  Using serif font.");
        font = new Font("serif", Font.PLAIN, 24);
    }
    return font;
}

From source file:DataCharts.LineGraph.java

public static JFreeChart createChart(XYDataset dataset) {

    JFreeChart chart = ChartFactory.createTimeSeriesChart("Customers by Month", "Months", "Customers", dataset);

    String fontName = "SansSerif";
    chart.getTitle().setFont(new Font(fontName, Font.BOLD, 18));
    chart.addSubtitle(new TextTitle(" ", new Font(fontName, Font.PLAIN, 14)));

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setDomainPannable(false);/*from   w w w  . j av a  2  s  .  c  o  m*/
    plot.setRangePannable(false);
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    plot.getDomainAxis().setLowerMargin(0.0);
    plot.getDomainAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
    plot.getDomainAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));

    plot.getRangeAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
    plot.getRangeAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));

    chart.getLegend().setItemFont(new Font(fontName, Font.PLAIN, 14));
    chart.getLegend().setFrame(BlockBorder.NONE);

    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(true);
        renderer.setDrawSeriesLineAsPath(false);
        // set the default stroke for all series
        renderer.setAutoPopulateSeriesStroke(false);

    }
    return chart;

}

From source file:Main.java

/**
 * Modifica fontul de la un label si il face bold
 * @param component//  ww  w .  j  ava2  s.c  o  m
 */
public static void setFontPlain(Component component) {
    Font oldFont = component.getFont();
    if (oldFont != null)
        component.setFont(oldFont.deriveFont(Font.PLAIN));
}

From source file:MyCanvas.java

public void paint(Graphics g) {
    Font courier = new Font("Courier", Font.PLAIN, 12);
    Font system = new Font("System", Font.BOLD, 16);
    Font helvetica = new Font("Helvetica", Font.BOLD, 18);

    g.setFont(courier);//from   w w w  .j a  va 2s  .c o m
    g.drawString("Courier", 10, 30);
    g.setFont(system);
    g.drawString("System", 10, 70);
    g.setFont(helvetica);
    g.drawString("Helvetica", 10, 90);
}

From source file:Main.java

public void paint(Graphics g) {
    int fontSize = 20;

    g.setFont(new Font("TimesRoman", Font.PLAIN, fontSize));

    g.drawString("www.java2s.com", 10, 20);
}

From source file:MainClass.java

public void paint(Graphics g) {
    Font f = new Font("Serif", Font.PLAIN, 12);
    g.setFont(f);//from   ww  w .  ja va  2s.  co  m
    g.drawString("Serif - PLAIN - 12", 10, 30);

    f = new Font("Sanserif", Font.ITALIC, 10);
    g.setFont(f);
    g.drawString("Sanserif - ITALIC - 10", 10, 60);

    f = new Font("Monospaced", Font.BOLD | Font.ITALIC, 14);
    g.setFont(f);
    g.drawString("Monospaced - BOLD and ITALIC - 14", 10, 90);

    f = new Font("Dialog", Font.PLAIN, 12);
    g.setFont(f);
    g.drawString("Dialog - PLAIN - 12", 10, 120);

    f = new Font("DialogInput", Font.BOLD + Font.ITALIC, 10);
    g.setFont(f);
    g.drawString("DialogInput - BOLD and ITALIC - 10", 10, 150);
}

From source file:Main.java

public void paint(Graphics g) {
    int fontSize = 20;

    g.setFont(new Font("TimesRoman", Font.PLAIN, fontSize));

    String s = "www.java2s.com";

    g.setColor(Color.black);/*from ww w.j av  a2s.  c  om*/
    g.drawString(s, 30, 30);
}

From source file:Main.java

/**
 * Returns an array of fonts created using specified array of font names.
 *
 * @param fontNames/*from ww w .  j  ava  2 s .c om*/
 *            array of font names
 * @return an array of fonts
 */
public static Font[] createFonts(final String[] fontNames) {
    final Font[] fonts = new Font[fontNames.length];
    for (int i = 0; i < fontNames.length; i++) {
        fonts[i] = new Font(fontNames[i], Font.PLAIN, 13);
    }
    return fonts;
}

From source file:Main.java

public void paint(Graphics g) {
    int fontSize = 20;
    Font font = new Font("TimesRoman", Font.PLAIN, fontSize);
    g.setFont(font);/*from w  w  w  .  j a va 2 s .  c o  m*/

    font.canDisplay('A');

    String s = "www.java2s.com";

    g.setColor(Color.black);
    g.drawString(s, 30, 30);
}