• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 360
  • Last Modified:

Use Java3D AND Openmap

Hi all,

I hope I am in the right topic!
I would like to view a Java3D scene from an openmap map,
so I read on the openmap web site that an OM3DViewerLauncher is needed: it is a
com.bbn.openmap.gui.Tool and said to be a button, however, when I add it to the ToolPanel which extends the swing class JToolBar, I had a ClassCastE0.xception due to the ToolPanel method  areComponentsVisible, in fact OM3DViewerLauncher is not a Component.

Does any one know about this problem?
Can you please explain me many thanks!

1 Solution
What type is it? For some reason you are tyring to cast it to a parent object that it is not.
emmokAuthor Commented:
Hi Girionis!

OM3DViewerLauncher class extends com.bbn.openmap.MapHandlerChild
and implements the Tool interface and ToolPanel extends javax.swing.JToolBar
implements java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, MapPanelChild, PropertyConsumer, java.awt.event.ComponentListener and we can add items using
add(Tool item, int index). So we can add a OM3DViewerLauncher  to a ToolPanel.
The problem is that in ToolPanel source code there is a method which casts items into Components, and I think the Exception comes from here.

public boolean areComponentsVisible() {
     Enumeration enum = items.elements();
     while (enum.hasMoreElements()) {
         Component comp = (Component)enum.nextElement();
         if (comp != filler && comp.isVisible()) {
             return true;
     return false;

So what is the right solution for using an OM3DViewerLauncher...
Thanks very much!
>  and I think the Exception comes from here.

Can you make *sure* that the exception is there? What line does it indicate?

ALso what is the output of this:

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

emmokAuthor Commented:
Yes I'm sure the pb comes from what I explained,
I have this error :
      at com.bbn.openmap.gui.ToolPanel.areComponentsVisible(ToolPanel.java:581)
      at com.bbn.openmap.gui.ToolPanel.setVisibility(ToolPanel.java:575)
      at com.bbn.openmap.gui.ToolPanel.add(ToolPanel.java:216)
      at com.bbn.openmap.gui.ToolPanel.add(ToolPanel.java:239)
      at com.bbn.openmap.gui.ToolPanel.add(ToolPanel.java:226)

Just remind you that the ToolPanel is not "accessible" it is a class of the
openmap API and I can't change it, I can only use it. The source code is available on the openmap web site : http://openmap.bbn.com.
You won't change it, you just need to cast it to appropriate type. What type is the object you receive from the: enum.nextElement(); ?
emmokAuthor Commented:
What I wanted to say is that I work on a customized application which uses
libraries and ToolPanel is normaly included in the openmap.jar!
How can I manipulate it???!!!!! I could just see the source code!?
Is it an open source? If yes then you should have the code already? Otherwise you can just decompile the jar files and get the source code.
emmokAuthor Commented:
openmap is an open source, and since I have the code I could see the
internal method of the API class ToolPanel. But I am on Eclipse
and the project uses the jar file as a library!?  
You might as well add all openmap source files in your project.
If you have the class files you can decompile them (you can use JAD for example to do this).
Normally an Opensource project is "open source", so you can download the source code from the site.
If you want to interact with source code in Eclipse, when you add the jar, specify where could be found the source code.

Hope this help you.
Bye, Giant.
emmokAuthor Commented:
Hi Giant2, Hi girionis,

Thanks for your suggestions, I have the source code (since it is an open source) and the solution is use the getFace() method of the OM3DViewerLauncher class which returs a Container...

Thanks very much,
Hello emmok, if you feel you have been helped please accept an answer of split the points. Otherwise ask a question to community support (http://www.experts-exchange.com/Community_Support/) for zero points to PAQ this question and refund the points back to you.
emmokAuthor Commented:
Hi girionis,

I've just asked a question to community support,


Fine by me.
PAQd, 150 points refunded.

Community Support Moderator
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now