// AttribStringDemo.java
import java.applet.Applet;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.font.TextAttribute;
import java.text.AttributedString;
public class AttribStringDemo extends Applet
{
AttributedString as;
public void init()
{
as = new AttributedString("An AttributedString holds text and related "+
"attribute information.");
as.addAttribute(TextAttribute.FONT,
new Font("Courier New", Font.BOLD, 12), 3, 19);
as.addAttribute(TextAttribute.FOREGROUND, Color.BLUE, 3, 19);
}
public void paint(Graphics g)
{
if (as != null)
{
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g.drawString(as.getIterator(), 30, 30);
}
}
}
이 글은 스프링노트에서 작성되었습니다.
'JAVA' 카테고리의 다른 글
자바로 컴퓨터 종료 (0) | 2012.05.15 |
---|---|
자바( 스크립트 사용 하여 리턴값 받기) (0) | 2012.05.15 |
실시간 파일 변경 알림 (0) | 2012.05.15 |
간단 수식계산기 (0) | 2012.05.15 |
String(문자열)내의 한글 확인 (0) | 2012.05.15 |