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 ...
随机推荐
- Linux 批量建立信任关系,实现ssh无password登陆的脚本
作用: 把当前机器的ssh公钥拷贝到其它机器.以实现从当前机器能够ssh无password登陆到其它机器 用法: 1)把要加入的ip地址写入到一个文件里.比方host 2)把脚本保存为sh文件,如 i ...
- Google大牛分享的面试秘籍
我憋了很长时间想写点关于去Google面试的秘籍.不过我总是推迟,因为写出来的东西会让你抓狂.很可能是这样.如果按统计规律来定义“你”的话,这文章很可能让你不爽. 为啥呢?因为啊……好吧,对此我写首小 ...
- [hihoCoder] #1096 : Divided Product
时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Given two positive integers N and M, please divide N into sev ...
- Android --------------------ActionBar 与 ViewPager 和 ActionTab 切换 的源代码实现
參考网址: 点击打开链接 源代码实现: package com.example.actionbardemo2; import android.app.ActionBar; import android ...
- 将数据库select出来的数据转化为与相应databean相应的字典
例如以下图: 从user_logs表格select出来的数据放在一个可变数组NSMutableArray中,如 user_logs,如今要 把数据一条条转化为Userlog databean,User ...
- 给openvpn客户分配固定ip地址
虽然openvpn提供dhcp服务,但是dhcp是有租约的,到期后会重新分配ip,造成连接中断的问题,所以最好还是给客户端固定一个ip. 思路:开启客户端配置目录,然后为每一个客户建一个配置文件,里面 ...
- GOKit全缓动类型gif列表
1.Linear 2.BackIn 3.BackInOut 4.BackOut 5.BounceIn 6.BounceInOut 7.BounceOut 8.CircIn 9.CircInOut 10 ...
- 关于Xilinx MicroBlaze应用modelsim se仿真问题(EDK:3593 - Unable to locate the precompiled library microblaze_v8_50_c)
ERROR:EDK:3593 - Unable to locate the precompiled library microblaze_v8_50_c. The file D:\Xilinx\14. ...
- 枚举操作的常用方法,包括获得枚举的value,name,description
public enum SendInfoStateEnum { [Description("等待提交")] 等待提交 = 1, [Description(& ...
- 理解HTTP幂等性,分布式事物
理解HTTP幂等性 基于HTTP协议的Web API是时下最为流行的一种分布式服务提供方式.无论是在大型互联网应用还是企业级架构中,我们都见到了越来越多的SOA或RESTful的Web API.为什么 ...