MyEclipse Console Print Text

Source: Internet
Author: User

Let's take a look:

Here's the code:

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 ("Blackbody", F Ont. PLAIN, 14);
AffineTransform at = new AffineTransform ();
FontRenderContext FRC = new FontRenderContext (at, true, true);
Glyphvector GV = Font.createglyphvector (FRC, "Su Xinghai wishes You:");//text to display
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)) br>{
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 ("~");//replace your preferred pattern
} else
{
System.out.print ("");
}
}
System.out.println ();
}
} catch (Exception e)
{
E.printstacktrace ();
}

Font font = new Font ("Blackbody", Font.plain, 16);
AffineTransform at = new AffineTransform ();
FontRenderContext FRC = new FontRenderContext (at, true, true);
Glyphvector gv1 = Font.createglyphvector (FRC, "Happy Dragon Boat Festival!! "); The text to display
Shape shape1 = Gv1.getoutline (2, 12);//distance between top and bottom two graphs
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 ("~");//Replace the pattern you like
} else
{
System.out.print ("");
}
}
System.out.println ();
}
}

}

MyEclipse Console Print Text

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.