Re: tabbed panes

Hi Adele,

Have a look at this web page, in particular *"5. How do I use Canvas3D's in JTabbedPane?*" at

I have just added the changes to DisplayPanelJ3D and made a small change to your test program, which fixes the TabbedPane problem.
The change to DisplayPanelJ3D is the same as outlined on the j3d web page.
The change to your test is that HeatPlot.getPanel() returns display.getComponent() instead of a JPanel with the display.getComponent() added to it.

To test for yourself make the following directories under your test program directory


and run the following

set classpath=.;visad_mods\;visad.jar;
javac visad_mods\visad\java3d\
java test

from the directory you have

It works on my computer. If you have any problems let me know.

Good luck.

Luke Matthews
Bureau of Meteorology, Australia
l.matthews *AT*

Curtis Rueden wrote:

Hi Adele,

I am not certain what is causing the tabbed pane to behave strangely. I
wonder whether Java3D in general has issues with JTabbedPane, or just VisAD.

In any case, here is an ugly hack that solves your problem for now:

 SwingUtilities.invokeLater(new Runnable() {
   public void run() {
     for (int i=tabbedPane.getTabCount()-1; i>=0; i--) {

Put this code *after* frame.setVisible(true). You'll also need to make the
tabbedPane declaration final.

As for the issue with data extending beyond the bounding box, you can clip
that away. The following code attached to your Heatplot displays will clip
the data to inside the bounding box only:

 DisplayRendererJ3D dr = (DisplayRendererJ3D) display.getDisplayRenderer();
 dr.setClip(0, true,  1.0f,  0.0f,  0.0f, -1.01f);  // X_POS face
 dr.setClip(1, true, -1.0f,  0.0f,  0.0f, -1.01f);  // X_NEG face
 dr.setClip(2, true,  0.0f,  1.0f,  0.0f, -1.01f);  // Y_POS face
 dr.setClip(3, true,  0.0f, -1.0f,  0.0f, -1.01f);  // Y_NEG face
 dr.setClip(4, true,  0.0f,  0.0f,  1.0f, -1.01f);  // Z_POS face
 dr.setClip(5, true,  0.0f,  0.0f, -1.0f, -1.01f);  // Z_NEG face

Hope that helps.

At 02:50 PM 2/2/2004, Adele Cutler wrote:


I'm using visad from the current visad.jar file, with j2sdk1.4.1_02 and
java3d-1_3_1-windows-i586-opengl-sdk. I'm having 2 difficulties with which I
would appreciate help/advice.

1. When I set up a tabbed pane, only the last-added tab is shown, even when
I use setSelectedIndex:

      JTabbedPane tabbedPane = new JTabbedPane();
      tabbedPane.addTab("pane1", pane1);
      tabbedPane.addTab("pane2", pane2);
      tabbedPane.addTab("pane3", pane3);
      tabbedPane.addTab("pane4", pane4);
      int is = tabbedPane.indexOfTab("pane1");

pane4 is the one I see. If I click on the pane4 tab, I can then click on the
first 3 tabs and see the correct images. I did read the tabbed pane postings
on the visad archive, which seemed to say the tabbed pane problem was
solved - I'm sorry, but I don't understand the details of those postings
well enough to fix my code. Can anyone help?

2. In a simple 2D plot, the image plots outside the axes (I also have an
older version of visAD, dated about a year ago, and this does not happen
with that version).

Both of these can be seen in a simplified version of my app, which I have

Thanks for any help you can provide.


  • 2004 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: