当前位置: 技术问答>java相关
请教!为什么在别的机上运行不能显示中文
来源: 互联网 发布时间:2015-08-23
本文导语: 用installanywhere制作的安装程序在本机运行正常,但当在别的机子上安装时去不能正常显示中文(jButton,jTable...里的中文都显示为“囗”,但jTextField显示正常。 | 如果显示的是方块,那么就有可...
用installanywhere制作的安装程序在本机运行正常,但当在别的机子上安装时去不能正常显示中文(jButton,jTable...里的中文都显示为“囗”,但jTextField显示正常。
|
如果显示的是方块,那么就有可能是因为字体问题
也许你的机器里装了那种字体,而对方机子里没有装
也许你的机器里装了那种字体,而对方机子里没有装
|
应该是字体的问题。试试在main()中加入:
Font f = new Font("宋体",Font.PLAIN,12);
UIManager.put("Label.font",f);
UIManager.put("Button.font",f);
UIManager.put("Menu.font",f);
UIManager.put("MenuItem.font",f);
UIManager.put("List.font",f);
UIManager.put("CheckBox.font",f);
UIManager.put("RadioButton.font",f);
UIManager.put("ComboBox.font",f);
UIManager.put("TextArea.font",f);
UIManager.put("Table.font",f);
UIManager.put("TableHeader.font",f);
不行就换成别的字体试试。
Font f = new Font("宋体",Font.PLAIN,12);
UIManager.put("Label.font",f);
UIManager.put("Button.font",f);
UIManager.put("Menu.font",f);
UIManager.put("MenuItem.font",f);
UIManager.put("List.font",f);
UIManager.put("CheckBox.font",f);
UIManager.put("RadioButton.font",f);
UIManager.put("ComboBox.font",f);
UIManager.put("TextArea.font",f);
UIManager.put("Table.font",f);
UIManager.put("TableHeader.font",f);
不行就换成别的字体试试。
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。