myeclipse控制台打印文字
先来看看效果图:
下面是代码:
import java.awt.Font;
import java.awt.Shape;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.awt.geom.AffineTransform;
public class Test
{
public static void main(String[] args)
{
try
{
Font font = new Font("黑体", Font.PLAIN, 14);
AffineTransform at = new AffineTransform();
FontRenderContext frc = new FontRenderContext(at, true, true);
GlyphVector gv = font.createGlyphVector(frc, "苏兴海祝您:"); // 要显示的文字
Shape shape = gv.getOutline(5, 22);
int weith = 150;
int height = 25;
boolean[][] view = new boolean[weith][height];
for (int i = 0; i < weith; i++)
{
for (int j = 0; j < height; j++)
{
if (shape.contains(i, j))
{
view[i][j] = true;
} else
{
view[i][j] = false;
}
}
}
for (int j = 0; j < height; j++)
{
for (int i = 0; i < weith; i++)
{
if (view[i][j])
{
System.out.print("~");// 替换成你喜欢的图案
} else
{
System.out.print(" ");
}
}
System.out.println();
}
} catch (Exception e)
{
e.printStackTrace();
}
Font font = new Font("黑体", Font.PLAIN, 16);
AffineTransform at = new AffineTransform();
FontRenderContext frc = new FontRenderContext(at, true, true);
GlyphVector gv1 = font.createGlyphVector(frc, "端午节快乐!!"); // 要显示的文字
Shape shape1 = gv1.getOutline(2, 12);//上下两个图的距离
int weith1 = 150;
int height1 = 25;
boolean[][] view1 = new boolean[weith1][height1];
for (int i = 0; i < weith1; i++)
{
for (int j = 0; j < height1; j++)
{
if (shape1.contains(i, j))
{
view1[i][j] = true;
} else
{
view1[i][j] = false;
}
}
}
for (int j = 0; j < height1; j++)
{
for (int i = 0; i < weith1; i++)
{
if (view1[i][j])
{
System.out.print("~");// 替换成你喜欢的图案
} else
{
System.out.print(" ");
}
}
System.out.println();
}
}
}
最新文章
- #ThinkPHP_3.2.2模型# where查询条件汇总
- C++ 编译器内存错误 after Normal block。。。
- linux c下mysql编程样例
- SharePoint 2013的HTML5特性之响应式布局
- TRIZ系列-创新原理-22-变害为利原理
- [css]《css揭秘》学习(四)-一个元素实现内圆角边框
- 模拟实现一个ATM+购物商城程序
- spring boot 文件上传大小限制
- 使用Spring Cloud连接不同服务
- 从MongoDB里面取得json格式的数据,然后存为本地的json文件,然后再从json读取变为dict
- Odoo Model内容详解
- STS或eclipse安装SVN插件
- django 常用字段类型
- 转 CentOS 7 minimal 版本安装后网络配置
- 基于zookeeper+mesos+marathon的docker集群管理平台
- Android开发大纲
- golang中使用mongodb
- SpringMVC+Hibernate 项目开发之一(Maven环境搭建)
- 标记编码报错ValueError: bad input shape ()
- memcached数据库
热门文章
- java线程池相关接口Executor和ExecutorService
- 133. Clone Graph (Graph, Map; DFS)
- ROS launch启动文件的理解与编写
- CentOS7下NFS服务安装及配置
- 查看linux服务器状态常用命令
- Android Studio真机测试失败-----&#39;&#39;No target device found";
- Send [1] times, still failed
- Linux 基础教程 28-nc命令
- test4 结对项目
- 二段Linq Groupby操作