簡體   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