最近心血来潮想试下新版的NetBeans 7.2.1,刚装上的时候是这个样子:
这宋体真是惨不忍睹啊!!!
折腾了两天,最终得到一个较为满意的效果,是这个样子:
NetBeans的字体其实是由四个部分组成的,如图所示。
在网上修改字体的办法,大部分只能修改第3部分和第4部分字体。
第1部分字体(菜单字体)这是当前操作系统决定的,Windows 7系统下的菜单还是很好看的,不用改。
但第2部分字体实在不能忍,宋体的英文那是相当的难看。
下面说说修改方法吧。
第1部分,如果你是在Windows系统上使用NetBeans,那基本上无需修改,系统菜单样式还是不错的。
第2部分,也是网上大多数修改方法没提到的。这个需要修改JDK的默认字体设置,然后调整NetBeans加载Swing控件的样式。
第3部分和第4部分,也是需要修改JDK的默认字体设置,但Netbeans无需做调整就可以使用。
怎样修改JDK字体呢?
要修改JDK的默认字体,首先要知道NetBeans用的是哪个JDK。
使用记事本工具打开安装目录下的文件:NetBeans\etc\netbeans.conf,
找到 netbeans_jdkhome="C:\Java\jdk1.7.0_10",
这里以我的jdk路径为例,打开C:\Java\jdk1.7.0_10\jre\lib目录,
找到fontconfig.properties.src文件,将其压缩备份,然后改名为fontconfig.properties,再使用记事本工具打开,并使用如下内容替换:
# # Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. # ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. # Version version=1 # Component Font Mappings allfonts.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 allfonts.chinese-gb18030=\u5FAE\u8F6F\u96C5\u9ED1 allfonts.chinese-hkscs=MingLiU_HKSCS allfonts.devanagari=Mangal allfonts.dingbats=Wingdings allfonts.lucida=Lucida Sans Regular allfonts.symbol=Symbol allfonts.thai=Lucida Sans Regular serif.plain.alphabetic=Times New Roman serif.plain.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 serif.plain.chinese-ms950=MingLiU serif.plain.hebrew=David serif.plain.japanese=MS Mincho serif.plain.korean=Batang serif.bold.alphabetic=Times New Roman Bold serif.bold.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 Bold serif.bold.chinese-ms950=PMingLiU serif.bold.hebrew=David Bold serif.bold.japanese=MS Mincho serif.bold.korean=Batang serif.italic.alphabetic=Times New Roman Italic serif.italic.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 serif.italic.chinese-ms950=PMingLiU serif.italic.hebrew=David serif.italic.japanese=MS Mincho serif.italic.korean=Batang serif.bolditalic.alphabetic=Times New Roman Bold Italic serif.bolditalic.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 Bold serif.bolditalic.chinese-ms950=PMingLiU serif.bolditalic.hebrew=David Bold serif.bolditalic.japanese=MS Mincho serif.bolditalic.korean=Batang sansserif.plain.alphabetic=Arial sansserif.plain.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 sansserif.plain.chinese-ms950=MingLiU sansserif.plain.hebrew=David sansserif.plain.japanese=MS Gothic sansserif.plain.korean=Gulim sansserif.bold.alphabetic=Arial Bold sansserif.bold.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 Bold sansserif.bold.chinese-ms950=PMingLiU sansserif.bold.hebrew=David Bold sansserif.bold.japanese=MS Gothic sansserif.bold.korean=Gulim sansserif.italic.alphabetic=Arial Italic sansserif.italic.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 sansserif.italic.chinese-ms950=PMingLiU sansserif.italic.hebrew=David sansserif.italic.japanese=MS Gothic sansserif.italic.korean=Gulim sansserif.bolditalic.alphabetic=Arial Bold Italic sansserif.bolditalic.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 Bold sansserif.bolditalic.chinese-ms950=PMingLiU sansserif.bolditalic.hebrew=David Bold sansserif.bolditalic.japanese=MS Gothic sansserif.bolditalic.korean=Gulim monospaced.plain.alphabetic=Consolas monospaced.plain.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 monospaced.plain.chinese-ms950=MingLiU monospaced.plain.hebrew=David monospaced.plain.japanese=MS Gothic monospaced.plain.korean=GulimChe monospaced.bold.alphabetic=Consolas Bold monospaced.bold.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 Bold monospaced.bold.chinese-ms950=PMingLiU monospaced.bold.hebrew=David Bold monospaced.bold.japanese=MS Gothic monospaced.bold.korean=GulimChe monospaced.italic.alphabetic=Consolas Italic monospaced.italic.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 monospaced.italic.chinese-ms950=PMingLiU monospaced.italic.hebrew=David monospaced.italic.japanese=MS Gothic monospaced.italic.korean=GulimChe monospaced.bolditalic.alphabetic=Consolas Bold Italic monospaced.bolditalic.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 Bold monospaced.bolditalic.chinese-ms950=PMingLiU monospaced.bolditalic.hebrew=David Bold monospaced.bolditalic.japanese=MS Gothic monospaced.bolditalic.korean=GulimChe dialog.plain.alphabetic=Arial dialog.plain.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 dialog.plain.chinese-ms950=MingLiU dialog.plain.hebrew=David dialog.plain.japanese=MS Gothic dialog.plain.korean=Gulim dialog.bold.alphabetic=Arial Bold dialog.bold.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 Bold dialog.bold.chinese-ms950=PMingLiU dialog.bold.hebrew=David Bold dialog.bold.japanese=MS Gothic dialog.bold.korean=Gulim dialog.italic.alphabetic=Arial Italic dialog.italic.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 dialog.italic.chinese-ms950=PMingLiU dialog.italic.hebrew=David dialog.italic.japanese=MS Gothic dialog.italic.korean=Gulim dialog.bolditalic.alphabetic=Arial Bold Italic dialog.bolditalic.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 Bold dialog.bolditalic.chinese-ms950=PMingLiU dialog.bolditalic.hebrew=David Bold dialog.bolditalic.japanese=MS Gothic dialog.bolditalic.korean=Gulim dialoginput.plain.alphabetic=Courier New dialoginput.plain.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 dialoginput.plain.chinese-ms950=MingLiU dialoginput.plain.hebrew=David dialoginput.plain.japanese=MS Gothic dialoginput.plain.korean=Gulim dialoginput.bold.alphabetic=Courier New Bold dialoginput.bold.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 Bold dialoginput.bold.chinese-ms950=PMingLiU dialoginput.bold.hebrew=David Bold dialoginput.bold.japanese=MS Gothic dialoginput.bold.korean=Gulim dialoginput.italic.alphabetic=Courier New Italic dialoginput.italic.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 dialoginput.italic.chinese-ms950=PMingLiU dialoginput.italic.hebrew=David dialoginput.italic.japanese=MS Gothic dialoginput.italic.korean=Gulim dialoginput.bolditalic.alphabetic=Courier New Bold Italic dialoginput.bolditalic.chinese-ms936=\u5FAE\u8F6F\u96C5\u9ED1 Bold dialoginput.bolditalic.chinese-ms950=PMingLiU dialoginput.bolditalic.hebrew=David Bold dialoginput.bolditalic.japanese=MS Gothic dialoginput.bolditalic.korean=Gulim # Search Sequences sequence.allfonts=alphabetic/default,dingbats,symbol sequence.serif.GBK=alphabetic,chinese-ms936,dingbats,symbol sequence.sansserif.GBK=alphabetic,chinese-ms936,dingbats,symbol sequence.monospaced.GBK=alphabetic,chinese-ms936,dingbats,symbol sequence.dialog.GBK=alphabetic,chinese-ms936,dingbats,symbol sequence.dialoginput.GBK=alphabetic,chinese-ms936,dingbats,symbol sequence.serif.GB18030=alphabetic,chinese-gb18030,dingbats,symbol sequence.sansserif.GB18030=alphabetic,chinese-gb18030,dingbats,symbol sequence.monospaced.GB18030=alphabetic,chinese-gb18030,dingbats,symbol sequence.dialog.GB18030=alphabetic,chinese-gb18030,dingbats,symbol sequence.dialoginput.GB18030=alphabetic,chinese-gb18030,dingbats,symbol sequence.serif.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol sequence.sansserif.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol sequence.monospaced.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol sequence.dialog.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol sequence.dialoginput.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol sequence.serif.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol sequence.sansserif.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol sequence.monospaced.x-MS950-HKSCS=chinese-ms950,alphabetic,chinese-hkscs,dingbats,symbol sequence.dialog.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol sequence.dialoginput.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol sequence.allfonts.UTF-8.hi=alphabetic/1252,devanagari,dingbats,symbol sequence.allfonts.windows-1255=hebrew,alphabetic/1252,dingbats,symbol sequence.serif.windows-31j=alphabetic,japanese,dingbats,symbol sequence.sansserif.windows-31j=alphabetic,japanese,dingbats,symbol sequence.monospaced.windows-31j=japanese,alphabetic,dingbats,symbol sequence.dialog.windows-31j=alphabetic,japanese,dingbats,symbol sequence.dialoginput.windows-31j=alphabetic,japanese,dingbats,symbol sequence.serif.x-windows-949=alphabetic,korean,dingbats,symbol sequence.sansserif.x-windows-949=alphabetic,korean,dingbats,symbol sequence.monospaced.x-windows-949=korean,alphabetic,dingbats,symbol sequence.dialog.x-windows-949=alphabetic,korean,dingbats,symbol sequence.dialoginput.x-windows-949=alphabetic,korean,dingbats,symbol sequence.allfonts.x-windows-874=alphabetic,thai,dingbats,symbol sequence.fallback=lucida,\ chinese-ms950,chinese-hkscs,chinese-ms936,chinese-gb18030,\ japanese,korean # Exclusion Ranges exclusion.alphabetic=0700-1e9f,1f00-20ab,20ad-f8ff exclusion.chinese-gb18030=0390-03d6,2200-22ef,2701-27be exclusion.hebrew=0041-005a,0060-007a,007f-00ff,20ac-20ac # Monospaced to Proportional width variant mapping # (Experimental private syntax) proportional.MS_Gothic=MS PGothic proportional.MS_Mincho=MS PMincho proportional.MingLiU=PMingLiU # Font File Names filename.Arial=ARIAL.TTF filename.Arial_Bold=ARIALBD.TTF filename.Arial_Italic=ARIALI.TTF filename.Arial_Bold_Italic=ARIALBI.TTF filename.Courier_New=COUR.TTF filename.Courier_New_Bold=COURBD.TTF filename.Courier_New_Italic=COURI.TTF filename.Courier_New_Bold_Italic=COURBI.TTF filename.Times_New_Roman=TIMES.TTF filename.Times_New_Roman_Bold=TIMESBD.TTF filename.Times_New_Roman_Italic=TIMESI.TTF filename.Times_New_Roman_Bold_Italic=TIMESBI.TTF filename.SimSun=SIMSUN.TTC filename.SimSun-18030=SIMSUN18030.TTC filename.MingLiU=MINGLIU.TTC filename.PMingLiU=MINGLIU.TTC filename.MingLiU_HKSCS=hkscsm3u.ttf filename.David=DAVID.TTF filename.David_Bold=DAVIDBD.TTF filename.MS_Mincho=MSMINCHO.TTC filename.MS_PMincho=MSMINCHO.TTC filename.MS_Gothic=MSGOTHIC.TTC filename.MS_PGothic=MSGOTHIC.TTC filename.Gulim=gulim.TTC filename.Batang=batang.TTC filename.GulimChe=gulim.TTC filename.Lucida_Sans_Regular=LucidaSansRegular.ttf filename.Mangal=MANGAL.TTF filename.Symbol=SYMBOL.TTF filename.Wingdings=WINGDING.TTF filename.Consolas=CONSOLA.TTF filename.Consolas_Bold=CONSOLAB.TTF filename.Consolas_Italic=CONSOLAI.TTF filename.Consolas_Bold_Italic=CONSOLAZ.TTF filename.\u5FAE\u8F6F\u96C5\u9ED1=msyh.ttf filename.\u5FAE\u8F6F\u96C5\u9ED1_Bold=msyhbd.ttf
这里可以使用搜索替换功能,替换你喜欢的字体。
怎样调整NetBeans加载的Swing控件的样式呢?
在刚才打开的netbeans.conf文件中找到netbeans_default_options设置项,
在设置项中加上 --laf 样式名称 参数即可。
我的第二张截图中使用的样式名为Nimbus,也可Google一下还有其他什么样式。
设置完毕后,保存所有文件,重启NetBeans.
另外,加载了额外样式的NetBeans要占用更多的内存,这里不妨再调整一下netbeans_default_options参数,像这样:
netbeans_default_options="-J-client -J-Xss2m -J-Xms256m -J-Xmx1024m -J-XX:PermSize=32m -J-XX:MaxPermSize=256m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true --laf Nimbus --fontsize 12"