2013-10-21 1 views
0

JFrame에 ttf-font를 포함하려고합니다. 물론 다양한 스레드를 많이 검색했습니다. 내가 다음 코드 시도했다 : 두 번째 줄에서TTF를 Java에 임베드하지 못했습니다.

InputStream is = getClass().getResourceAsStream("abc.ttf"); 
Font myFont = Font.createFont(Font.TRUETYPE_FONT, is); 
Font abcFont = myFont.deriveFont(Font.TRUETYPE_FONT,40); 

을 (Font myFont = ...) 일식은 다음과 같은 오류가 표시되고 :

Multiple markers at this line: 
-unhandled exception type IOException 
-unhandled exception type FontFormatException 

는 해결책을 알고 희망! 감사합니다.

답변

0

설정 크기를 40으로 설정하려면 40F으로 설정해야합니다.