RE: tabbed panes

Hi Adele,

If you need the data boxes to be centered properly, you can do that by
manually overriding your ScalarMap ranges, with setRange.

Try the following code after you construct your ScalarMaps:

  double xmod = 1.0 / (ncols + 1);
  double ymod = 1.0 / (nitem + 1);
  colmMap.setRange(-xmod, ncols + xmod + 1);
  rowMap.setRange(-ymod, nitem + ymod + 1);

As for "centered on integers," that'll depend on your sample values.
                        
Cheers,
-Curtis

At 04:12 PM 2/2/2004, Adele Cutler wrote:
>Hi Curtis,
>
>        Many thanks - the tabbed pane now works perfectly.
>
>        The bounding box clip, however, does not do what I need - I need the 
> boxes
>to all be the same size and to be centered on integers.
>
>        Thanks again.
>
>Adele
>
>-----Original Message-----
>From: Curtis Rueden [mailto:curtis@xxxxxxxxxxxxx]
>Sent: Monday, February 02, 2004 2:52 PM
>To: Adele Cutler
>Cc: visad@xxxxxxxxxxxxxxxx
>Subject: Re: tabbed panes
>
>
>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--) {
>        tabbedPane.setSelectedIndex(i);
>        tabbedPane.validate();
>      }
>    }
>  });
>
>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.
>-Curtis
>
>At 02:50 PM 2/2/2004, Adele Cutler wrote:
>
>>Hi,
>>
>>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");
>>        tabbedPane.setSelectedIndex(is);
>>
>>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
>>attached.
>>
>>Thanks for any help you can provide.
>>
>>Adele