使用substance后Swing控件上的中文全部显示为方框。 这大概由于substance的look and feel替换了原来的字体,使得中文无法正常显示。解决办法是在设置使用substance的Look and Feel 之后,加入下面的语句:
int sizeOffset = 1 ;
Enumeration keys = UIManager.getLookAndFeelDefaults().keys() ;
while ( keys.hasMoreElements() )
{
Object key = keys.nextElement() ;
Object value = UIManager.get( key ) ;
if ( value instanceof Font )
{
Font oldFont = ( Font ) value ;
Font newFont = new Font( "Dialog", oldFont.getStyle(),
oldFont.getSize() + sizeOffset ) ;
UIManager.put( key, newFont ) ;
}
}
没有评论:
发表评论