private Graphics2D createSVGGraphics2D(int w,int h){
  try {
    Class<?> svgGraphics2d=Class.forName("org.jfree.graphics2d.svg.SVGGraphics2D");
    Constructor<?> ctor=svgGraphics2d.getConstructor(int.class,int.class);
    return (Graphics2D)ctor.newInstance(w,h);
  }
 catch (  ClassNotFoundException ex) {
    return null;
  }
catch (  NoSuchMethodException ex) {
    return null;
  }
catch (  SecurityException ex) {
    return null;
  }
catch (  InstantiationException ex) {
    return null;
  }
catch (  IllegalAccessException ex) {
    return null;
  }
catch (  IllegalArgumentException ex) {
    return null;
  }
catch (  InvocationTargetException ex) {
    return null;
  }
}

private Graphics2D createSVGGraphics2D ( int w , int h ) { try { Class < ? > svgGraphics2d = Class . forName ( "org.jfree.graphics2d.svg.SVGGraphics2D" ) ; Constructor < ? > ctor = svgGraphics2d . getConstructor ( int . class , int . class ) ; return ( Graphics2D ) ctor . newInstance ( w , h ) ; } catch ( ClassNotFoundException ex ) { return null ; } catch ( NoSuchMethodException ex ) { return null ; } catch ( SecurityException ex ) { return null ; } catch ( InstantiationException ex ) { return null ; } catch ( IllegalAccessException ex ) { return null ; } catch ( IllegalArgumentException ex ) { return null ; } catch ( InvocationTargetException ex ) { return null ; } }
this is copied from jfreechart ' s chartpanel class ( version 1 . 0 . 19 ) .
