Re: visad display won't resize

Donna-

By default, JPanel has a FlowLayout which causes the problems
you see.  Try using a BorderLayout and put your display in
the default (Center) position.

Not that it is obvious, but here's somethings in the archives
along that line:

http://www.unidata.ucar.edu/cgi-bin/msgout?/glimpse/visad-list/2522
http://www.unidata.ucar.edu/cgi-bin/msgout?/glimpse/visad-list/1843

Don

Donna L Gresh wrote:



I have looked in the mailing list without luck in solving this problem.
Basically, I just want to have the visad panel resize when my application
panel resize. This works in the first implementation of my application,
where all of the visad stuff is in the same class as the entire JFrame
which encloses it. However, since I didn't want to keep reinventing the
wheel everytime I wanted to put a particular kind of visad picture in a
panel, I separated out all the visad stuff into a separate class, called
"DisplayThreeDimensionalSurface" which extends the JPanel class. Just
before finishing up the constructor for this class, I do a

   add((JPanel) theDisplay.getComponent());

 However, now the display no longer responds to changes in the size of the
panel which contains it. It stays the same size no matter what (I'm not
sure what size it is; perhaps 400x400, but this is not a number that
appears anywhere in my code)

Basically in my code for the frame containing the picture I do something
like
     DisplayThreeDimensionalSurface threed = new
DisplayThreeDimensionalSurface();
     JPanel visadpictureholder = new JPanel();
      visadpictureholder.add(threed);

      However even explicit calls to "visadpictureholder.resize(200,200)"
do nothing. Also I tried when the DisplayThreeDimensionalSurface is
initially created to do

       theDisplay.getComponent().setSize(100,100);
       this.setSize(100,100);
       this.setPreferredSize(new Dimension(100,100));

none of which changed the initial size of the visad picture. How can I
force the size of the visad picture?
Thanks in advance for any help
Donna



Donna L. Gresh, Ph.D.
IBM T.J. Watson Research Center
(914) 945-2472
http://www.research.ibm.com/people/g/donnagresh
gresh@xxxxxxxxxx


--
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************



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