java学习基地

微信扫一扫 分享朋友圈

已有 392 人浏览分享

java初学者,关于资源绑定类的问题求大神指点

[复制链接]
392 0
进修java国际化一章时,测试书中例题(源码太少,那里只粘揭毛病处所),呈现毛病以下,视年夜神辅导,拜开!public void setCurrentLocale(Locale locale){
                currentLocale =locale;
                localeCombo.setSelectedItem(currentLocale);
                localeCombo.setLocale(currentLocale);
                res=ResourceBundle.getBundle("retire.RetireResources",currentLocale);
                resStrings=ResourceBundle.getBundle("retire.RetireStrings",currentLocale);
                currencyFmt=NumberFormat.getCurrencyInstance(currentLocale);
                numberFmt=NumberFormat.getNumberInstance(currentLocale);
                percentFmt=NumberFormat.getPercentInstance(currentLocale);
                updateDisplay();
                updateInfo();
                updateData();
                updateGraph();
        }

Exception in thread "AWT-EventQueue-0" java.util.MissingResourceException: Can't find bundle for base name retire.RetireResources, locale zh_CN
        at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
        at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
        at java.util.ResourceBundle.getBundle(ResourceBundle.java:845)
        at retire.RetireFrame.setCurrentLocale(Retire.java:144)
        at retire.RetireFrame.<init>(Retire.java:128)
        at retire.Retire$1.run(Retire.java:39)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
        at java.awt.EventQueue.access$400(EventQueue.java:97)
        at java.awt.EventQueue$3.run(EventQueue.java:697)
        at java.awt.EventQueue$3.run(EventQueue.java:691)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:714)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.ClassCastException: retire.RetireResources cannot be cast to ResourceBundle
        at java.util.ResourceBundle$Control.newBundle(ResourceBundle.java:2647)
        at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1501)
        at java.util.ResourceBundle.findBundle(ResourceBundle.java:1465)
        at java.util.ResourceBundle.findBundle(ResourceBundle.java:1419)
        at java.util.ResourceBundle.findBundle(ResourceBundle.java:1419)
        at java.util.ResourceBundle.findBundle(ResourceBundle.java:1419)
        at java.util.ResourceBundle.findBundle(ResourceBundle.java:1419)
        at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1361)
        ... 18 more

举报 使用道具

回复
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

0

关注

0

粉丝

129

主题
精彩推荐
热门资讯
网友晒图
图文推荐

Archiver|手机版|java学习基地 |网站地图

GMT+8, 2021-4-11 06:01 , Processed in 0.740263 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.