FileDocCategorySizeDatePackage
fits.javaAPI DocExample1424Thu Apr 03 15:27:46 BST 1997None

fits

public class fits extends Frame implements ContentHandlerFactory

Fields Summary
URL
u
Image
theImage
String
name
ContentHandler
fc
Constructors Summary
public fits(String s)

  
    super(s);
    name = s;
  
  
Methods Summary
public java.net.ContentHandlercreateContentHandler(java.lang.String mimetype)

  
    if (mimetype.equalsIgnoreCase("image/x-fits")) return fc;
    return null;
  
  
public voidinit()

  
    try {
    
      u = new URL("http://sunsite.unc.edu/javafaq/" + name);            
      
      ImageProducer ip = (ImageProducer) u.getContent();
      if (ip == null)  {
        System.err.println("Content handler returned null");
      }
      else {
       theImage = createImage(ip);
      }

    }
    catch (MalformedURLException e) {
      System.err.println(e);
    }
    catch (IOException e) {
      System.err.println(e);
    }
    catch (NullPointerException e) {
      System.err.println(e);
      e.printStackTrace();
    }
    
  
public static voidmain(java.lang.String[] args)

  
    String name;
    if (args.length == 0) name = "test.fit";
    else name = args[0] + ".fits";
  
    fits f = new fits(name);
    URLConnection.setContentHandlerFactory(f);
    f.resize(252, 252);
    f.fc = new fitsContentHandler();
    f.init();
    f.show();
  
  
public voidpaint(java.awt.Graphics g)

  
    g.drawImage(theImage, 0, 0, this);