Meaningless Drivel is fun!
The moose likes Swing / AWT / SWT and the fly likes Unable to understand how to remove exception raised here. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Unable to understand how to remove exception raised here." Watch "Unable to understand how to remove exception raised here." New topic

Unable to understand how to remove exception raised here.

Yaki Kumar

Joined: Feb 01, 2010
Posts: 12

Below is the code for my ChatManager Class.

I wrote a FChatManager - for Facebook Chat as below:

Further I have ChatBuddy class that represents User/Buddy available for chat ... I get it when I receive Presence packet .

What I wanted to do is add/remove users, along with their images (which I could get from vCard) from a List in the ChatManager as and when they become available/unavailable. The problem is, I keep getting following...

Class of value: class javax.swing.plaf.basic.BasicPanelUI
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.plaf.basic.BasicPanelUI cannot be cast to ui.ChatBuddy
at ui.ChatManager$BuddyRenderer.getListCellRendererComponent(
at javax.swing.plaf.basic.BasicListUI.updateLayoutState(
at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(
at javax.swing.plaf.basic.BasicListUI.getPreferredSize(
at javax.swing.JComponent.getPreferredSize(
at javax.swing.ScrollPaneLayout.layoutContainer(
at java.awt.Container.layout(
at java.awt.Container.doLayout(
at java.awt.Container.validateTree(
at java.awt.Container.validate(
at javax.swing.RepaintManager.validateInvalidComponents(
at javax.swing.SystemEventQueueUtilities$

at java.awt.event.InvocationEvent.dispatch(
at java.awt.EventQueue.dispatchEventImpl(
at java.awt.EventQueue.access$000(
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(

What I don't get is I am adding a ChatBuddy at Line Number 60 in FChatManager to the List.. via ChatManager's addBuddy(ChatBuddy buddy) at Line No. 60 in ChatManager but javax.swing.plaf.basic.BasicPanelUI is what it gets... which is all the reason I think its failing. How could I get rid of this?? I don't have in depth knowledge of Java
Please I need help... after so long I have zeroed to using JList to display users online and also wrote a Simple Program and adding some custom Object to List.. there it said that the object received was the one that I had added.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
wild guess

maybe it should be
Yaki Kumar

Joined: Feb 01, 2010
Posts: 12

Thanks, Dunn. It was a silly mistake.
Just one more thing? Do you think, my design is kind of Okay?? Like doing most of the thing is an abstract class (Chat Manager)... and doing only Specific Things .. like related to Facebook in FChatManager which extends ChatManager??
Thanks a LOT.
I agree. Here's the link:
subject: Unable to understand how to remove exception raised here.
It's not a secret anymore!