Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java程序分享区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
reply to topicflat modethreaded modego to previous topicgo to next topicgo to back
话题被移动
该话题已被移动 - floater , 2005-03-21 03:51
如果您尚不清楚该话题被移动的原因,请参考论坛规则以及本版公告或者联系本版版主。
作者 Hibernate8IDE(Console)查询结果如何才能够显示中文...
YuLimin

简单就是美

版主


发贴: 866
于 2005-03-19 19:32 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
软件环境:
Hibernate 2.1.8

Hibernate Console 2.1

MySQL 4.1.10a-nt与Oracle 9i
配置文件:
#Hibernate Console properties
#Fri Mar 18 20:52:44 CST 2005
console.custom.classpath=Z\:\\Java\\classes
console.hbm.xml=Z\:\\Java\\classes\\hibernate.cfg.xml
console.hibernate.properties=
错误提示信息:
Hibernate8IDE(Console)查询结果如何才能够显示中文结果?现在都是方框,何解?
你的分析:
是不是取出中文之后也要进行编码转换?

查看源码:
在HQLQueryPage类的getList()方法中增加一条System.out.println(element);来查看信息,显示正确是中文。。。何解?

QueryPageView类的makeUpdatePropertyAction方法中加句System.out.printlnClock;

鼠标点中选择的内容,也是显示为正确的中文啊。何解?



 当兵不后悔!后悔不当兵! 
超越黎明时空,追逐时代潮流!
人,是要靠自己的!简单就是美!
我的Java:http://www.Java2Class.net
我的Blog:http://YuLimin.ItEye.com
作者 Re:Hibernate8IDE(Console)查询结果如何才能够显示中文... [Re:YuLimin]
YuLimin

简单就是美

版主


发贴: 866
于 2005-03-20 00:21 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
凡是方框的都是字体没设成中文字体,凡是问号的都是转码不对。

终于找到最终解决问题的方法了。

如下进行修改:
1、net.sf.hibernate.console.Start里增加函数:
public static void setUIFont(javax.swing.plaf.FontUIResource f)
{
java.util.Enumeration keys = UIManager.getDefaults().keys();
while(keys.hasMoreElements())
{
Object key = keys.nextElement();
Object value = UIManager.get(key);
if(value instanceof javax.swing.plaf.FontUIResource)
{
UIManager.put(key,f);
}
}
}

2、在main函数中调用
setUIFont(new javax.swing.plaf.FontUIResource("宋体",Font.PLAIN,12));

3、编译,重新打包,运行,Good Luck



 当兵不后悔!后悔不当兵! 
超越黎明时空,追逐时代潮流!
人,是要靠自己的!简单就是美!
我的Java:http://www.Java2Class.net
我的Blog:http://YuLimin.ItEye.com
作者 Re:Hibernate8IDE(Console)查询结果如何才能够显示中文... [Re:YuLimin]
YuLimin

简单就是美

版主


发贴: 866
于 2005-03-20 00:22 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
在设计Application的时间我曾经为了统一设置字体都用过这个了,怎么就没有转过弯来

如下:

setUIFont(new FontUIResource("宋体",Font.PLAIN,12));

public static void setUIFont(javax.swing.plaf.FontUIResource f)
{
//取得所有的缺省UIResource属性键。
java.util.Enumeration keys = UIManager.getDefaults().keys();
while(keys.hasMoreElements())
{
Object key = keys.nextElement();
Object value = UIManager.get(key);
//判断键值是否为FontUIResource,如果是则将其设为指定FontUIResource。
if(value instanceof javax.swing.plaf.FontUIResource)
{
UIManager.put(key,f);
}
}
}



 当兵不后悔!后悔不当兵! 
超越黎明时空,追逐时代潮流!
人,是要靠自己的!简单就是美!
我的Java:http://www.Java2Class.net
我的Blog:http://YuLimin.ItEye.com
作者 Re:Hibernate8IDE(Console)查询结果如何才能够显示中文... [Re:YuLimin]
floater

Java Jedi

总版主


发贴: 3233
于 2005-03-21 03:50 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
please don't cross post, thanks.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler, Refactoring - Improving the Design of Existing Code
作者 Re:Hibernate8IDE(Console)查询结果如何才能够显示中文... [Re:YuLimin]
YuLimin

简单就是美

版主


发贴: 866
于 2005-03-21 19:57 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
总版,不好意思,刚开始是我对此问题不解,特发问题来向大家请教的,后来自己解决了这个问题,我就把解决问题后的源码与方法发到共享区与发问题的贴子里了。


 当兵不后悔!后悔不当兵! 
超越黎明时空,追逐时代潮流!
人,是要靠自己的!简单就是美!
我的Java:http://www.Java2Class.net
我的Blog:http://YuLimin.ItEye.com

reply to topicflat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923