Eclipse下的插件開發如果需要用到什么字體或其他的工具時,盡量避免使用AWT GraphicsEnvironment ,這會導致Vista Aero效果暫停工作。如果有需要得到Font字體列表的話,可以使用SWT的FontList拿到:
1
public static String[] getSystemFontNames( Comparator comparator )
2
{
3
FontData[] fontDatas = (FontData [])Display.getCurrent( ).getFontList( null, false );
4
SortedSet set = new TreeSet(comparator);
5
for(int i=0;i<fontDatas.length;i++)
{
6
set.add( fontDatas[i].getName( ) );
7
}
8
fontDatas = ( FontData [] )Display.getCurrent( ).getFontList( null, true );
9
for(int i=0;i<fontDatas.length;i++)
{
10
set.add( fontDatas[i].getName( ));
11
}
12
String[] fonts = new String[set.size( )];
13
set.toArray( fonts );
14
return fonts;
15
}

2



3

4

5



6

7

8

9



10

11

12

13

14

15















