• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Custom ComboBox with icon

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,



Above is my coding, when I run the file it show me

Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.String
at Lion_Dance.Judge$ComboBoxRenderer.getListCellRendererComponent(

I am not sure where is wrong. Please help
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Rancher
Posts: 3267
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First you need to learn how to post a proper demo program.

1) We don't have time to read through 400 llines of code. So you need to learn how to create a SSCCE (Short, Self Contained, Compilable and Executable, Example Program), that demonstrates the incorrect behaviour.

2) The code you posted doesn't compile. Most of use don't use an IDE to create a GUI so we don't have access to the org.desktop.layout.GroupLayout class. So if you want us to run your code then you need to post executable code, which is why you create a SSCCE.

Finally, the error messages tells you the problem. You get a ClassCastException. It should also tell you the line that is causing the problem. It found a String, but your code is expecting something else. So either your data is wrong or the code is wrong.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic