Feeling

              三人行,必有我師焉

             ::  :: 新隨筆 :: 聯系 ::  :: 管理 ::
            185 隨筆 :: 0 文章 :: 392 評論 :: 0 Trackbacks

          Eclipse下的插件開發如果需要用到什么字體或其他的工具時,盡量避免使用AWT GraphicsEnvironment ,這會導致Vista Aero效果暫停工作。如果有需要得到Font字體列表的話,可以使用SWT的FontList拿到:

           1    public static String[] getSystemFontNames( Comparator comparator )
           2    {
           3        FontData[] fontDatas = (FontData [])Display.getCurrent( ).getFontList( nullfalse );
           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( nulltrue );
           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    }

          /**
           * Returns <code>FontData</code> objects which describe
           * the fonts that match the given arguments. If the
           * <code>faceName</code> is null, all fonts will be returned.
           *
           * 
          @param faceName the name of the font to look for, or null
           * 
          @param scalable if true only scalable fonts are returned, otherwise only non-scalable fonts are returned.
           * 
          @return the matching font data
           *
           * 
          @exception SWTException <ul>
           *    <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
           * </ul>
           
          */

          public FontData [] getFontList (String faceName, boolean scalable)
          posted on 2007-04-30 16:34 三人行,必有我師焉 閱讀(1118) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          GitHub |  開源中國社區 |  maven倉庫 |  文件格式轉換 
          主站蜘蛛池模板: 定边县| 聂拉木县| 扶风县| 溧阳市| 同心县| 高唐县| 崇文区| 巧家县| 乌拉特中旗| 高淳县| 通山县| 大埔县| 潼关县| 隆昌县| 化州市| 深圳市| 枝江市| 湘潭市| 绍兴县| 卓资县| 扎赉特旗| 磴口县| 班戈县| 湘乡市| 浑源县| 云南省| 绍兴市| 阳城县| 纳雍县| 哈尔滨市| 万宁市| 民丰县| 玉环县| 青州市| 泸州市| 富宁县| 苗栗县| 密云县| 交城县| 金乡县| 新邵县|