java - Font Awsome on JButton -



java - Font Awsome on JButton -

i trying display font awesome icons on jbutton. did following

font font = null; seek { font = font.createfont(font.truetype_font, new file("../icons/fontawesome-webfont.ttf")); font = font.derivefont(18f); graphicsenvironment ge = graphicsenvironment.getlocalgraphicsenvironment(); ge.registerfont(font); } grab ( fontformatexception ex ){ex.printstacktrace();} grab ( ioexception ex ){ex.printstacktrace();} private jbutton save_btn = new jbutton(); save_btn.setfont(font); save_btn.settext("\uf0c7"); save_btn.setpreferredsize( buttondimension );

but

if utilize font with jtextarea, works fine :

jtextarea t = new jtextarea(); t.setrows( 2); t.setcolumns( 12); t.setfont( font ); t.settext( "\uf0f3 \uf1ec \uf0f3 \uf1ec"); buttonpanel.add(t);

i

my guess button dimensions little displaying symbol want display , button reverts showing "..." don't seem have representations in font-awesome.

java swing

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -