简体   繁体   English

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

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

this is my working tree 这是我的工作树

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"));
}

I'm getting the error: "Exception in thread "AWT-EventQueue-0" java.util.MissingResourceException: Can't find bundle for base name Presentation.Bundle, locale pt_PT": 我收到错误消息:“线程“ AWT-EventQueue-0”中的异常java.util.MissingResourceException:找不到基础名称Presentation.Bundle,语言环境pt_PT的捆绑软件”:

Exception in thread "AWT-EventQueue-0" java.util.MissingResourceException: Can't find bundle for base name Presentation/Bundle, locale pt_PT at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564) at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387) at java.util.ResourceBundle.getBundle(ResourceBundle.java:773) at Presentation.IdiomaUI.jComboBox1ActionPerformed(IdiomaUI.java:136) at Presentation.IdiomaUI.access$000(IdiomaUI.java:17) at Presentation.IdiomaUI$1.actionPerformed(IdiomaUI.java:56) at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1258) at javax.swing.JComboBox.setSelectedItem(JComboBox.java:586) at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:622) at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(BasicComboPopup.java:834) at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290) at java.awt.Component.processMouseEvent(Component.java:6525) at javax.swing.JComponent.processMouseEvent(JCo 线程“ 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) mponent.java:3321) at javax.swing.plaf.basic.BasicComboPopup$1.processMouseEvent(BasicComboPopup.java:498) at java.awt.Component.processEvent(Component.java:6290) at java.awt.Container.processEvent(Container.java:2234) at java.awt.Component.dispatchEventImpl(Component.java:4881) at java.awt.Container.dispatchEventImpl(Container.java:2292) at java.awt.Component.dispatchEvent(Component.java:4703) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462) at java.awt.Container.dispatchEventImpl(Container.java:2278) at java.awt.Window.dispatchEventImpl(Window.java:2739) at java.awt.Component.dispatchEvent(Component.java:4703) at 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 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) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86) at java.awt.EventQueue$4.run(EventQueue.java:719) at java.awt.EventQueue$4.run(EventQueue.java:717) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.awt.EventQueue.dispatchEvent(EventQueue.java:716) 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 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) :82)

I've already searched about this and i haven't figured it out what the problem is. 我已经对此进行了搜索,但还没有弄清楚问题出在哪里。 Help please! 请帮助!

If your Locale is set to Portuguese then the ResourceBundle will attempt to load content from a properties file called Bundle_pt_PT.properties . 如果您的Locale设置设置为葡萄牙语,则ResourceBundle将尝试从名为Bundle_pt_PT.properties的属性文件中加载内容。 According to the screenshot you don't have this in your project. 根据屏幕截图,您的项目中没有此功能。

Take a look here for more information on ResourceBundles/localisation in Java And here for some general information on supported Locales. 在此处查看有关Java中ResourceBundles /本地化的更多信息,并在此处了解有关支持的语言环境的一些常规信息。

暂无
暂无

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

相关问题 .MissingResourceException:找不到基本名称的包 - .MissingResourceException: Can't find bundle for base name MissingResourceException - 找不到基本名称的包 - MissingResourceException - Can't find bundle for base name MissingResourceException:找不到基本名称的捆绑 - MissingResourceException: Can't find bundle for base name java.util.MissingResourceException:找不到基本名称的包 - java.util.MissingResourceException: Can't find bundle for base name MissingResourceException:运行 JAR 时找不到基本名称的捆绑包 - MissingResourceException: Can't find bundle for base name when running JAR java.util.MissingResourceException:找不到基本名称的包 - java.util.MissingResourceException: Can't find bundle for base name java.util.MissingResourceException:找不到基本名称包的包 - java.util.MissingResourceException: Can't find bundle for base name Bundle java.util.MissingResourceException:找不到基本名称为ResBundle的包,语言环境为en_GB - java.util.MissingResourceException: Can't find bundle for base name ResBundle, locale en_GB java.util.MissingResourceException:找不到基本名称消息的bundle,locale en_US - java.util.MissingResourceException: Can't find bundle for base name messages, locale en_US MissingResourceException:找不到基本名称资源的捆绑包。controls.controls_res,语言环境 - MissingResourceException: Can't find bundle for base name resources.controls.controls_res, locale en
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM