Re: display geometry - do they alway have to be square?

Ugo,

Many thanks for that tip. Basically it worked (after translation to Jython, and a little tweaking).

-Frank

At 03:26 AM 8/14/2002, you wrote:
Hi Frank,

Frank Gibbons wrote:
>
> Thanks for yesterday's tip, Bill, on getting two displays into a single
> container. I've been playing around with different layout managers. I
> notice that with FlowLayout and GridLayout, the displays are always square.
> How do I control the geometry of the displays? I'd like them to make better
> use of my screen real estate, by conforming to the JFrame geometry, but
> they only obey the vertical size of the container, not its horizontal size.

Perhaps what you want is described in:

http://www.geogr.uni-jena.de/~p6taug/visad/tutorial/s4/Section4.html#section4_12

If you display is in a JFrame, then you can also:

      jFrame.addComponentListener( new ComponentAdapter(){

        public void componentResized(ComponentEvent e)  {

          if(sticky){ // if sticky, VisAD display takes dimensions of
parent frame
            Dimension dim = display.getComponent().getSize();//
jFrame.getSize();

            int x = dim.width;
            int y = dim.height;
            double f = (x >= y) ? (double) x : (double) y;

            setAspect( new  double[]{1,(double) y/f, 1} );  // see
below...
          }
        }
      });



where

  public void setAspect(double[] aspect){
    try{
      ProjectionControl projCont = display.getProjectionControl();  //
display is you VisAD.DisplayImpl
      projCont.setAspectCartesian(aspect);

    } catch (RemoteException re) {re.printStackTrace();
    } catch (VisADException ve) {ve.printStackTrace();}
  }


Note the difference between
projCont.setAspectCartesian(aspect); -> keeps proportions
and
projCont.setAspect(aspect);     -> squeezes axis (fonts, cross-cursor,...)
according to aspect.

If you have display inside some other component, then use the
appropriate listener.

>
> Forgive me if this is an obvious window-manager issue. But I thought
> GridLayout should control both dimensions of the geometry.

Hope that helps.

>
> Thanks for any suggestions, as always.
>
> -Frank
>
> PhD, Computational Biologist,
> Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA.
> Tel: 617-432-3555       Fax:
> 617-432-3557       http://llama.med.harvard.edu/~fgibbons


Cheers,

Ugo

PhD, Computational Biologist,
Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA.
Tel: 617-432-3555 Fax: 617-432-3557 http://llama.med.harvard.edu/~fgibbons


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