Re: visad display won't resize


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:


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
     DisplayThreeDimensionalSurface threed = new
     JPanel visadpictureholder = new JPanel();

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

       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 L. Gresh, Ph.D.
IBM T.J. Watson Research Center
(914) 945-2472

Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307

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