繁体   English   中英

MissingResourceException:找不到基本名称的捆绑

[英]MissingResourceException: Can't find bundle for base name

这是我的工作树

Object selecao = jComboBox1.getSelectedItem();
if(selecao.equals("English")){
    //Locale local = new Locale("en", "EN");
    this.bundle = ResourceBundle.getBundle("Presentation.Bundle", Locale.UK);
    this.jLabel1.setText(bundle.getString("IdiomaUI.jLabel1.text"));
    this.confirmarBt.setText(bundle.getString("IdiomaUI.confirmarBt.text"));
    this.cancelarBt.setText(bundle.getString("IdiomaUI.cancelarBt.text"));
}else if(selecao.equals("Português")){
    this.bundle = ResourceBundle.getBundle("Presentation.Bundle");
    this.jLabel1.setText(bundle.getString("IdiomaUI.jLabel1.text"));
    this.confirmarBt.setText(bundle.getString("IdiomaUI.confirmarBt.text"));
    this.cancelarBt.setText(bundle.getString("IdiomaUI.cancelarBt.text"));
}

我收到错误消息:“线程“ AWT-EventQueue-0”中的异常java.util.MissingResourceException:找不到基础名称Presentation.Bundle,语言环境pt_PT的捆绑软件”:

线程“ AWT-EventQueue-0”中的异常java.util.MissingResourceException:找不到java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)上基本名称Presentation / Bundle,语言环境pt_PT的捆绑包。在Presentation.IdiomaUI.jComboBox1ActionPerformed(IdiomaUI.java:136)上的Presentation.IdiomaUI.java:136上的java.util.ResourceBundle.getBundle(ResourceBundle.java:773)上的ResourceBundle.getBundleImpl(ResourceBundle.java:1387)在Presentation.IdiomaUI.access $ 000(IdiomaUI.java: 17)在Presentation.IdiomaUI $ 1.actionPerformed(IdiomaUI.java:56)在javax.swing.JComboBox.fireActionEvent(JComboBox.java:1258)在javax.swing.JComboBox.setSelectedItem(JComboBox.java:586)在javax.swing .java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)上的.JComboBox.setSelectedIndex(JComboBox.java:622)在javax.swing.plaf.basic.BasicComboPopup $ Handler.mouseReleased(BasicComboPopup.java:834) javax.swing.JComponent.processMouseEvent(JCo上的awt.Component.processMouseEvent(Component.java:6525) javax.swing.plaf.basic.BasicComboPopup $ 1.processMouseEvent(BasicComboPopup.java:498)处的mponent.java:3321)java.awt.Container.processEvent(java.awt.Component.processEvent(Component.java:6290)处的mponent.java:3321)在java.awt.Component.dispatchEventImpl(Component.java:4881)在Container.java:2234)在java.awt.Component.dispatchEvent(Component.java:4703在java.awt.Container.dispatchEventImpl(Container.java:2292) )的java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)的java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)的java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)的Java的java.awt.Window.dispatchEventImpl(Window.java:2739)的.Container.dispatchEventImpl(Container.java:2278)的java.awt.Component.dispatchEvent(Component.java:4703)的java.awt.EventQueue.dispatchEventImpl( EventQueue.java:746)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:69 1)位于java.security.ProtectionDomain $ 1.doIntersectionPrivilege(ProtectionDomain.java:75)处的java.security.AccessController.doPrivileged(本机方法)位于java.awt处的java.security.ProtectionDomain $ 1.doIntersectionPrivilege(ProtectionDomain.java:86) .java.awt.EventQueue $ 4.run(EventQueue.java:717)的java.security.AccessController.doPrivileged(本机方法)处的java.awt.EventQueue $ 4.run(EventQueue.java:719)(java.security.ProtectionDomain $ 1.doIntersectionPrivilege( ProtectionDomain.java:75),位于java.awt.EventQueue.dispatchEvent(EventQueue.java:716),位于java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201),位于java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) )在java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)在java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)在java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)在java.awt .EventDispatchThread.run(EventDispatchThread.java :82)

我已经对此进行了搜索,但还没有弄清楚问题出在哪里。 请帮助!

如果您的Locale设置设置为葡萄牙语,则ResourceBundle将尝试从名为Bundle_pt_PT.properties的属性文件中加载内容。 根据屏幕截图,您的项目中没有此功能。

在此处查看有关Java中ResourceBundles /本地化的更多信息,并在此处了解有关支持的语言环境的一些常规信息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM