e591. Drawing Simple Text
Posted borter
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了e591. Drawing Simple Text相关的知识,希望对你有一定的参考价值。
See also e575 The Quintessential Drawing Program.
public void paint(Graphics g) { // Set the desired font if different from default font String family = "Serif"; int style = Font.PLAIN; int size = 12; Font font = new Font(family, style, size); g.setFont(font); // Draw a string such that its base line is at x, y int x = 10; int y = 10; g.drawString("aString", x, y); // Draw a string such that the top-left corner is at x, y x = 10; y = 30; FontMetrics fontMetrics = g.getFontMetrics(); g.drawString("aString", x, y+fontMetrics.getAscent()); }
Related Examples |
以上是关于e591. Drawing Simple Text的主要内容,如果未能解决你的问题,请参考以下文章
LightOj1285 - Drawing Simple Polygon(连接多边形各点)
text 此片段用于以下知识库文章 - http://kb.wpbeaverbuilder.com/article/591-create-a-filter-to-customize-the-di
e575. The Quintessential Drawing Program
Error in bl_make_text_box(token, drawing_context$gp, drawing_context$yoff_pt) : function ‘Rcpp_preci