java.lang.ClassCastException: java.lang.String cannot be cast to inventory.Book

Coderanch | Dan D'Apice | 4 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Displaying ArrayList data in a GUI's Text Fields - Part II

    Coderanch | 4 years ago | Dan D'Apice
    java.lang.ClassCastException: java.lang.String cannot be cast to inventory.Book

    Root Cause Analysis

    1. java.lang.ClassCastException

      java.lang.String cannot be cast to inventory.Book

      at inventory.InventoryGUI.jComboBox1ActionPerformed()
    2. inventory
      InventoryGUI$2.actionPerformed
      1. inventory.InventoryGUI.jComboBox1ActionPerformed(InventoryGUI.java:182)
      2. inventory.InventoryGUI.access$100(InventoryGUI.java:10)
      3. inventory.InventoryGUI$2.actionPerformed(InventoryGUI.java:95)
      3 frames
    3. Java RT
      EventDispatchThread.run
      1. javax.swing.JComboBox.fireActionEvent(JComboBox.java:1260)
      2. javax.swing.JComboBox.setSelectedItem(JComboBox.java:588)
      3. javax.swing.JComboBox.setSelectedIndex(JComboBox.java:624)
      4. javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(BasicComboPopup.java:835)
      5. java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
      6. java.awt.Component.processMouseEvent(Component.java:6505)
      7. javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
      8. javax.swing.plaf.basic.BasicComboPopup$1.processMouseEvent(BasicComboPopup.java:499)
      9. java.awt.Component.processEvent(Component.java:6270)
      10. java.awt.Container.processEvent(Container.java:2229)
      11. java.awt.Component.dispatchEventImpl(Component.java:4861)
      12. java.awt.Container.dispatchEventImpl(Container.java:2287)
      13. java.awt.Component.dispatchEvent(Component.java:4687)
      14. java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
      15. java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
      16. java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
      17. java.awt.Container.dispatchEventImpl(Container.java:2273)
      18. java.awt.Window.dispatchEventImpl(Window.java:2719)
      19. java.awt.Component.dispatchEvent(Component.java:4687)
      20. java.awt.EventQueue.dispatchEventImpl(EventQueue.java:723)
      21. java.awt.EventQueue.access$200(EventQueue.java:103)
      22. java.awt.EventQueue$3.run(EventQueue.java:682)
      23. java.awt.EventQueue$3.run(EventQueue.java:680)
      24. java.security.AccessController.doPrivileged(Native Method)
      25. java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
      26. java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
      27. java.awt.EventQueue$4.run(EventQueue.java:696)
      28. java.awt.EventQueue$4.run(EventQueue.java:694)
      29. java.security.AccessController.doPrivileged(Native Method)
      30. java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
      31. java.awt.EventQueue.dispatchEvent(EventQueue.java:693)
      32. java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
      33. java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
      34. java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
      35. java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
      36. java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
      37. java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
      37 frames