List of usage examples for java.awt Font BOLD
int BOLD
To view the source code for java.awt Font BOLD.
Click Source Link
From source file:Main.java
public Main() { setFont(new Font("TimesRoman", Font.BOLD | Font.ITALIC, 48)); setSize(225, 175); }
From source file:Main.java
public void paint(Graphics g) { int fontSize = 20; g.setFont(new Font("TimesRoman", Font.BOLD, fontSize)); String s = "www.java2s.com"; g.setColor(Color.black);/*from w w w . j a va2s . c o m*/ g.drawString(s, 30, 30); }
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 ww. j a v a 2 s . 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) { g.setFont(new Font("SansSerif", Font.BOLD, 12)); FontMetrics fm = g.getFontMetrics(); g.drawString("Current font: " + g.getFont(), 10, 40); g.drawString("Ascent: " + fm.getAscent(), 10, 55); g.drawString("Descent: " + fm.getDescent(), 10, 70); g.drawString("Height: " + fm.getHeight(), 10, 85); g.drawString("Leading: " + fm.getLeading(), 10, 100); Font font = new Font("Serif", Font.ITALIC, 14); fm = g.getFontMetrics(font);//from w w w. j a va2s . co m g.setFont(font); g.drawString("Current font: " + font, 10, 130); g.drawString("Ascent: " + fm.getAscent(), 10, 145); g.drawString("Descent: " + fm.getDescent(), 10, 160); g.drawString("Height: " + fm.getHeight(), 10, 175); g.drawString("Leading: " + fm.getLeading(), 10, 190); }
From source file:Main.java
/** * Sets font style for the specified component. * * @param component/*from www . j a v a2 s .com*/ * component to modify * @param bold * whether should set bold font or not * @param italic * whether should set italic font or not * @param <C> * component type * @return modified component */ public static <C extends Component> C setFontStyle(final C component, final boolean bold, final boolean italic) { final int style = bold && italic ? Font.BOLD | Font.ITALIC : bold ? Font.BOLD : italic ? Font.ITALIC : Font.PLAIN; return setFontStyle(component, style); }
From source file:FontPanel.java
public void paintComponent(Graphics g) { super.paintComponent(g); Font f = new Font("SansSerif", Font.BOLD, 14); Font fi = new Font("SansSerif", Font.BOLD + Font.ITALIC, 14); FontMetrics fm = g.getFontMetrics(f); FontMetrics fim = g.getFontMetrics(fi); String s1 = "Java "; String s2 = "Source and Support"; String s3 = " at www.java2s.com"; int width1 = fm.stringWidth(s1); int width2 = fim.stringWidth(s2); int width3 = fm.stringWidth(s3); Dimension d = getSize();/* www . j av a2 s . c o m*/ int cx = (d.width - width1 - width2 - width3) / 2; int cy = (d.height - fm.getHeight()) / 2 + fm.getAscent(); g.setFont(f); g.drawString(s1, cx, cy); cx += width1; g.setFont(fi); g.drawString(s2, cx, cy); cx += width2; g.setFont(f); g.drawString(s3, cx, cy); }
From source file:Main.java
public void paint(Graphics g) { Font f = g.getFont();//from w w w. ja v a 2s. co m int fontSize = f.getSize(); int fontStyle = f.getStyle(); String msg = ", Size: " + fontSize + ", Style: "; if ((fontStyle & Font.BOLD) == Font.BOLD) msg += "Bold "; if ((fontStyle & Font.ITALIC) == Font.ITALIC) msg += "Italic "; if ((fontStyle & Font.PLAIN) == Font.PLAIN) msg += "Plain "; g.drawString(msg, 4, 16); }
From source file:MainClass.java
public void paint(Graphics g) { Font f = new Font("Serif", Font.PLAIN, 12); g.setFont(f);//w w w . j ava2 s. 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:metrics.java
License:asdf
metrics() {
setFont(new Font("TimesRoman", Font.BOLD | Font.ITALIC, 48));
setSize(225, 175);
}
From source file:st.jigasoft.dbutil.util.ReportTheme.java
public static void circularTheme(JFreeChart chart, String... colunsName) { chart.setBackgroundPaint(/*from ww w .j ava2s.c o m*/ new GradientPaint(new Point(0, 0), new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY)); 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); int iCount = 0; // use gradients and white borders for the section colours for (Object s : colunsName) { plot.setSectionPaint(s.toString(), createGradientPaint(new Color(200, 200, 255), colorItems(iCount++))); if (iCount == MAX_COLUNS_COLOR) iCount = 0; } plot.setBaseSectionOutlinePaint(Color.WHITE); plot.setSectionOutlinesVisible(true); plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f)); 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); }