Re: DisplayImpl.getImage()

Hi Hank,
> 1.  I have had some limited success, except for the fact
> that when the image returns, it is the black screen with the
> small white lettered "please wait" at the bottom.  Obviously
> I am returning the image before it is fully loaded into the
> offscreen display.  I have tried using the
> getDisplayRenderer.getWaitFlag(), but it still does not wait
> long enough.  Is there another way for me to find out when
> the image is completely loaded into the offscreen display?
Glad to hear of your success.  Try making your class implement
the DisplayListener interface, add it to your DisplayImpl as a
and implement a method:
  public void displayChanged(DisplayEvent e) {
    if (e.getId() == DisplayEvent.TRANSFORM_DONE) {
      image = display.getImage();
Note that visad/jmet/ uses TRANSFORM_DONE
You may also want to bracket your DisplayImpl setup between
display.disableAction() and display.enableAction() (as is done
in visad/jmet/, so that there will only be one
> 2.  When I run the DisplayTest cases 50-52 on an NT machine,
> the copied image is not loaded into its frame until I resize
> the frame.  I don't know if this has anything to do with
> image loading or if this is the intended functionality.
Sorry about this.  I don't use NT and will have to check
DisplayTest cases 50-52 on an NT machine.  If DisplayTest case
58 works on your NT machine, then the following might work:
  ProjectionControl control = display.getProjectionControl();
  int count = -1;
and then:
  public void displayChanged(DisplayEvent e) {
    if (e.getId() == DisplayEvent.TRANSFORM_DONE) {
      count = 4;
    else if (e.getId() == DisplayEvent.FRAME_DONE) {
      if (count > 0) {
      else if (count == 0) {
        image = display.getImage();
This waits for your data to be transformed into a scene graph,
then triggers a sequence of 4 re-draws, then gets the image.
Since manually resizing the frame helps, it may be useful to
  Component comp = display.getComponent();
to the above after both 'control.setMatrix(control.getMatrix())'.
Please let me know if these things do not solve your problem.
One way or another we'll get it.  These event things can be tricky,
and I don't think we completely understand AWT and Swing yet.

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