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的更多相关文章
- LightOJ 1285 - Drawing Simple Polygon (几何,极角排序)
1285 - Drawing Simple Polygon PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: ...
- Html5: Drawing with text
<!DOCTYPE html> <html> <head> <meta name="viewport" content="wid ...
- e586. Drawing Simple Shapes
There are two ways to draw basic shapes like circles, ovals, lines, arcs, squares, rectangles, round ...
- reactjs simple text editor
import React, { Component } from 'react' import PubSub from 'pubsub' import GlobalVars from 'globalV ...
- Drawing Simple Polygon(Create Simple Polygon from unordered points by angle sorting)
Keywords: 极角排序, Simple Polygon Generation Given set of points in the plane, your task is to draw a p ...
- LightOj1285 - Drawing Simple Polygon(连接多边形各点)
题目链接:http://lightoj.com/volume_showproblem.php?problem=1285 题意:给你一些点,然后把它们用一条线把它们连起来,构成一个多边形,不能有相交,必 ...
- e577. Enabling Antialiasing
// See e575 The Quintessential Drawing Program public void paint(Graphics g) { // Retrieve the graph ...
- html5 canvas simple drawing
var c = canvas.getContext("2d");//get canvas 2d context canvas including a proposed 3D con ...
- [OpenCV] Samples 01: drawing
基本的几何图形,标注功能. commondLineParser的使用参见:http://blog.csdn.net/u010305560/article/details/8941365 #includ ...
随机推荐
- mysql-5.7中innodb_buffer_pool页面淘汰算法
一. 什么是innodb_buffer_pool: innodb_buffer_pool是一块内存区域,innodb用它来缓存数据,索引,undo,change buffer ... : 这块区域又被 ...
- FreeBSD搭建SVN服务器
我最喜欢使用的OS就是FreeBSD,而且现在刚好有一台FreeBSD服务器,所以我想把我的SVN服务器迁移到FreeBSD上,再配合hudson和ant就可以自动编译了. 第一步:安装svn: 在安 ...
- centos 下Qt安装 mysql驱动(亲测可行)
(前半部分没有试过,因为我的有mysql驱动,实在抱歉) 1.预防万一,先安装一下mysql-devel(一定要装!). 不安装的话后面编译会出现找不到-lmysqlclient的问题. 2. 开始编 ...
- 笔试面试1 用C实现C库函数itoa, atoi
要求用C实现C库函数itoa或者是atoi.也就是字符串和数字的相互转换. 事实上这是一个很easy的问题. 可是有次笔试我没有理解好题意,也没有想到事实上这就是一个怎样将数字以字符串的方式存放. 这 ...
- 安装perl的版本控制器perlbrew
perlbrew可以用源码方式安装perl的各种版本,可以容纳多个perl版本共存,并随意切换. 1.把perlbrew安装到home目录: curl -L https://install.perlb ...
- 学习笔记之gethostbyname函数
我们现在认知一台计算机主机通常采用直观可读的名字.例如博客园我们会记住 www.cnblogs.com 而不是记住42.121.252.58这个IP.对于大多数的应用程序来说应该是处理名字而不是处理地 ...
- AngularJS 初始化加载流程
一.AngularJS 初始化加载流程 1.浏览器载入HTML,然后把它解析成DOM.2.浏览器载入angular.js脚本.3.AngularJS等到DOMContentLoaded事件触发.4.A ...
- 转载:Jmeter教程索引
摘自: 阳光温暖了心情 的 http://www.cnblogs.com/yangxia-test/category/431240.html 1 JMeter学习(一)工具简单介绍 2 JMeter学 ...
- 多重连接的数据库管理工具:Navicat Premium
多重连接的数据库管理工具:Navicat Premium 2016-09-26 Navicat Premium(非免费软件)是一个可多重连接的数据库管理工具,它可让你以单一程序同时连接到MySQL.O ...
- Windows下对postgre开启远程连接权限
编辑 删除 前言:Windows下对postgre开启远程连接权限,下面是实际操作过程中的手顺 1.找到postgresql.conf文件,注意安装路径 D:\Program Files (x86)\ ...