RE: Repainting images in JyVisAD + sketch

Hi Curtis, 

Yippee, someone gets what I'm trying to do!  Student labs are closed
over the weekend, will try out what you said on Monday morning.

>I'm not certain whether your goal is to have four displays (an
"original",
>an "x2", an "x3" and an "x4"), or just one or two displays that get
updated >when the buttons are pressed.  

I'm after the latter; find attached a screen shot of a sketch of the
program.  I'm not sure if one is allowed to sending .gifs to a mailing
list, I've made it as small as possible.  Apologies in advance...

>Adding components to a window that already onscreen can be tricky, and
>should be avoided if possible.

Tell me about it...

Cheers!
Chi-chi
PS I actually meant I'd moved makeDisplay() *out* of the twist() methods
in my earlier reply to Bill.

-----Original Message-----
From: Curtis Rueden [mailto:curtis@xxxxxxxxxxxxx] 
Sent: 17 May 2003 02:25
To: Chi-chi Ekweozor
Subject: Re: Repainting images in JyVisAD

Hi Chi-chi,

Your problem is due to the unusual layout you're attempting
to use for your Swing components.  You can "fix" the problem
by adding the following two lines as the last two lines of
your twist1 subroutine:

    frame.validate()
    frame.repaint()

However, you may notice that your old, unstretched display is
being crunched into the five-pixel gap between the (new) left
and right displays.  Certainly that is not the desired
behavior.

I suggest not creating new displays on button click. Instead,
create all desired displays, add them to the GUI, all at the
beginning of the program.  When the user clicks a button,
update the relevant displays as desired.  I'm not certain
whether your goal is to have four displays (an "original",
an "x2", an "x3" and an "x4"), or just one or two displays
that get updated when the buttons are pressed.  But either
one should be possible without needing to add displays later.
Adding components to a window that already onscreen can be
tricky, and should be avoided if possible.

Good luck,
-Curtis


Attachment: TheImageStretcher.gif
Description: GIF image

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