regarding 2d image and boundary

   Please find appended a program which is a modification to an example program 
from the tutorial
on VisAD. Essential it draws iso-contours for temperature values and fills 
these contours. Most
experts will find it a trivial program.
   My question is this. The image generated is not filling up the screen i.e., 
there seems to be a padded
area drawn around the actual image. How can I eliminate this "border" so that 
the required image fills
up the entire space of (NumXPixels * NumYPixels)? Appreciate your help.
Ramesh Mantri

// ===========================================================================
import visad.*;
import visad.java2d.DisplayImplJ2D;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;

public class Image2D {
   private RealType longitude, latitude;
   private RealType temperature;

   private RealTupleType domain_tuple;

   private FunctionType func_domain_range;

   private Set domain_set;

   private FlatField vals_ff;

   private DataReferenceImpl data_ref;

   private DisplayImpl display;
   private ScalarMap latMap, lonMap;
   private ScalarMap tempIsoMap, tempRGBMap;

   public Image2D(float[] data, int NCOLS, int NROWS) throws Exception {
      latitude = RealType.getRealType("latitude");
      longitude = RealType.getRealType("longitude");

      domain_tuple = new RealTupleType(latitude, longitude);

      temperature = RealType.getRealType("temperature");

      func_domain_range = new FunctionType( domain_tuple, temperature);

      domain_set = new Linear2DSet(domain_tuple, 1,NROWS,NROWS, 1,NCOLS,NCOLS);

      float[][] set_samples = domain_set.getSamples(true);

      float[][] flat_samples = new float[1][NCOLS * NROWS];

      for (int dataIndex=0; dataIndex < data.length; dataIndex++) {
         int dataCol = (dataIndex % NCOLS);
         int dataRow = (dataIndex / NCOLS);

         int sampleIndex = ((dataCol * NROWS) + dataRow);

         flat_samples[0][sampleIndex] = data[dataIndex];

      vals_ff = new FlatField( func_domain_range, domain_set);
      vals_ff.setSamples( flat_samples , false );

      int NumXPixels = 450;
      int NumYPixels = 450;

      if (NROWS != NCOLS) {
         boolean Xmax = (NCOLS > NROWS);
         if (Xmax) {
            NumYPixels = (int) ((NumXPixels * NROWS) / NCOLS);
         } else {
            NumXPixels = (int) ((NumYPixels * NCOLS) / NROWS);

      display = new DisplayImplJ2D("display1", NumXPixels, NumYPixels);

      latMap = new ScalarMap( latitude,    Display.YAxis );
      lonMap = new ScalarMap( longitude, Display.XAxis );
      tempIsoMap = new ScalarMap( temperature,  Display.IsoContour );
      tempRGBMap = new ScalarMap( temperature,  Display.RGB );

      display.addMap( latMap );
      display.addMap( lonMap );
      display.addMap( tempIsoMap );
      display.addMap( tempRGBMap );

      ContourControl isoControl = (ContourControl) tempIsoMap.getControl();
      float[] levels = {295.0f, 305.0f, 500.0f};
      isoControl.setLevels(levels, 294.0f, false);

      data_ref = new DataReferenceImpl("data_ref");
      data_ref.setData( vals_ff );

      display.addReference( data_ref );

      double ar = ((double) NumYPixels) / ((double) NumXPixels);
      ProjectionControl pc = display.getProjectionControl();
      pc.setAspect(new double[] {1.0, ar});

   public void writeToFile() throws IOException {
      BufferedImage image = display.getImage(true);
      File file = new File("iso_contour_image.png");
      ImageIO.write(image, "PNG", file);

   public static void main(String[] args) {
      try {
         float[] data = {
                           318.0f, 312.0f, 297.0f, 299.0f, 302.0f,
                           315.0f, 311.0f, 296.0f, 297.0f, 299.0f,
                           306.0f, 298.0f, 297.0f, 294.0f, 294.0f,
                           297.0f, 296.0f, 294.0f, 291.0f, 294.0f,
                           297.0f, 291.0f, 293.0f, 287.0f, 285.0f,
                           297.0f, 296.0f, 296.0f, 291.0f, 291.0f

         Image2D imgObj = new Image2D(data, 5, 6);

         System.out.println("Image written to file");
      } catch (Exception e) {
// ===========================================================================