How can I make ANY vector  graphics with graphics2D and save on clipboard?

I am at my wits end here, and need some help. Simply put, I have a program that creates a basic x-y graph, drawn in a jpanel. I want to create the graph as a vector (emf, eps, svg, I don't care anymore, any of them would be good). But, all I get is a jpg or bitmap.
I tried using the infamous FreeHEP programs, but it won't recognize the output as anything but "image" which means bitmap/jpg.
     The user enters x/y data, clicks a button, which crreates a jpanel thusly:
public class GraphMaker extends JPanel {
static BufferedImage image = new BufferedImage(600, 500, BufferedImage.TYPE_INT_ARGB);
GraphMaker(double[] xVals, double[] yVals, double[] sems){
setPreferredSize(new Dimension (600,500));     
symSize = 10;
XminV = 0;
XmaxV = 0;
// code here just converts input x and y's to pixel coordinates, spacing of ticks, etc...
for (int i =0;i < ArLn; i++){
gX[i] = xO + (gX[i] * xRat);
gX[i] -= xStart;
gY[i] = gY[i] * yRat;
gY[i] = yEnd - gY;
semVal[i] = semVal[i]*yRat;
     Ymin = yEnd - (Ymin*yRat);
     Ymax = yEnd - (Ymax*yRat);
BufferedImage anImage = new BufferedImage(600, 500, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = anImage.createGraphics();
g2.setBackground(white);
g2.setColor( Color.WHITE );
g2.fillRect(0,0,600,500);
g2.setStroke(stroke);
// here I use the values to draw lines and circles - nothing spectacular:
          g2.setPaint(Color.blue);
          int ii = 0;
          for ( int j = 0; j < ArLn[ii]; j++ ) {
g2.fill(new Ellipse2D.Float(LgX[ii][j] - symOffst, gY[ii][j]-symOffst, symSize,symSize));
g2.draw(new Line2D.Float(LgX[ii][j],(gY[ii][j]-semVal[ii][j]),LgX[ii][j],(gY[ii][j]+semVal[ii][j])));
g2.draw(new Line2D.Float(LgX[ii][j]-2.0f,(gY[ii][j]-semVal[ii][j]),LgX[ii][j]+2.0f,(gY[ii][j]-semVal[ii][j])));
g2.draw(new Line2D.Float(LgX[ii][j]-2.0f,(gY[ii][j]+semVal[ii][j]),LgX[ii][j]+2.0f,(gY[ii][j]+semVal[ii][j])));
                    g2.draw(new Line2D.Float(xLoVal[ii],yLoVal[ii],xHiVal[ii],yHiVal[ii]));
image = anImage;
And, when the user clicks on the "copy" button, invokes this:
public class Freep implements Transferable, ClipboardOwner {
     public static final DataFlavor POSTSCRIPT_FLAVOR = new DataFlavor("application/postscript", "Postscript");
     private static DataFlavor[] supportedFlavors = {
          DataFlavor.imageFlavor,
          POSTSCRIPT_FLAVOR,
          DataFlavor.stringFlavor
     private static JPanel chart;
     private int width;
     private int height;
     public Freep(JPanel theGraph, int width, int height) {
          this.theGraph = Graphs;
          this.width = width;
          this.height = height;
//******This is the key method right here: It is ALWAYS imageFlavor, never anything else. How do I make this an EPS flavor?
     public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
if (flavor.equals(DataFlavor.imageFlavor)) {
return GraphMaker.image;
else if (flavor.equals(POSTSCRIPT_FLAVOR)) {
               return new ByteArrayInputStream(epsOutputStream().toByteArray());
else if (flavor.equals(DataFlavor.stringFlavor)) {
               return epsOutputStream().toString();
          } else{
               throw new UnsupportedFlavorException(flavor);
     private ByteArrayOutputStream epsOutputStream() throws IOException {
EPSDocumentGraphics2D g2d = new EPSDocumentGraphics2D(false);
g2d.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext());
ByteArrayOutputStream out = new ByteArrayOutputStream();
     public DataFlavor[] getTransferDataFlavors() {
          return supportedFlavors;
     public boolean isDataFlavorSupported(DataFlavor flavor) {
          for(DataFlavor f : supportedFlavors) {
               if (f.equals(flavor))
                    return true;
          return false;
     public void lostOwnership(Clipboard arg, Transferable arg1) {
The same happens with FreeHEP - I want the flavor to be EMF, but the program sees an image so it is always imageFlavor. I know I am missing something, but what, I don't know.
thanks for your help.

I don't think there's a built-in solution. One workaround I've seen is to create a dummy graphics class that overrides the desired drawing functions. Instead of actually drawing pixels, the object writes postscript commands to a buffer. There also seems to be commercial code that does exactly this.

Similar Messages

  • How can I make my Outlook sync with ical and address book on more than one mac?

    It currently syncs with my iMac through 'this computer' folder, but i dont have outlook on my macbook, so basically... how can i make my outlook automatically convert/sync to icloud enabled folders?
    Not too confusing i hope.

    Outlook won't work with iCloud. On your Mac.

  • How can I make a bullet item with a custom Bullet character such as a check mark ?

    Hi Everyone,
        I'd like to make a list with Bullets, but I can find a bullet character which I am looking for. Especially I'd like to make Bullet characters available in PowerPoint, such as check mark, and others. How can I make a bullet item with a custom Bullet character or picture such as a check mark ?
      Regards
      Cem

    Cem777 wrote:
    Hi Everyone,
        I'd like to make a list with Bullets, but I can find a bullet character which I am looking for. Especially I'd like to make Bullet characters available in PowerPoint, such as check mark, and others. How can I make a bullet item with a custom Bullet character or picture such as a check mark ?
      Regards
      Cem
    Search InDesign help for "change bullet characters" (without quotes,) and use the technique described there with the Zapf Dingbat font as suggested by Peter S.
    You can also use InDesign's glyphs panel (Window > Type & Tables > Glyphs) to scroll through all the character sets in all the fonts that InDesign has access to on your system, to look for check mark characters.
    After you have created a paragraph style that applies the customized check-mark-bullet that you want, every time you apply that paragraph style, the custom bullet appears. So, while it's a few steps to set up the style the first time, from then on it's automatic.
    If you really need a particular bullet that's not in any font you have, you'll need to search for fonts that have check mark characters and buy one or use a free one. Caution: free fonts aren't always created to the same strict standards that commercial fonts from reputable font foundries observe; free fonts sometimes cause problems when printing or exporting to PDF. You can search Google for "fonts with check mark" (without quotes.)
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • How can I make Thunderbird start auto with windows start-up

    how can I make Thunderbird start auto with windows start-up

    You can by placing a short cut in the windows startup folder, just like any other windows program.
    However if you do you are likely to encounter problems as downloading mail while the anti virus is still loading and the network is busy announcing your machines arrival to the network ( which might be a network of one) and any of a dozen other program are loading is fraught with risk of timeouts and server disconnections as well as error messages that make little sense because they are about something that is still loading.
    So the bottom line is sure you can, but if there are issues take it back out of there as a first step.

  • How can i make a soft return with pages shift enter does not work!

    how can i make a soft return with pages shift plus enter does not work!!

    On full keyboards with a numeric keypad, the key above the right shift is "return" & the one on the numeric section is "enter." On a Mac (or Apple IIgs ) they do have separate functions. On the "mini" keyboards, both names are on the same key, but "enter" is written in smaller letters. I'll have to check to see how that works on another Mac later today.

  • How can I make Web Photo Gallery with Photoshop CS6 on Mac 10.6.8?

    How can I make Web Photo Gallery with Photoshop CS6 on Mac 10.6.8?

    You can use Bridge to create a web photo gallery.
    Here's a video that shows you how to do it:
    Hope this helps!
    Julia

  • How can i make sure the graphic file from my subcontract create is really llegal?

    how can i make sure the graphic file from my subcontract create is really llegal?
    They have creat the PNG file which creat from Adobe Illustrator CS5.
    I have try checking on Metadata In Adobe Bridge, and it seem to be blank.
    So i would likt to know how can i make sure the graphic file from my subcontract create is really llegal?
    Thanks

    I have try checking on Metadata In Adobe Bridge, and it seem to be blank.
    So i would likt to know how can i make sure the graphic file from my subcontract create is really llegal?
    shoo: if i had to do that for every file i get  i would go insane, as scott said, post contract: files that they (sub contractor) supply you, presume them ok unless you KNOW otherwise, or a copyright flag pops up contradicting ownership.
    G

  • I have Win 7 saved (installation file) in My MacBook Pro Licence version. How can i install it on MacBook Pro. After installation how can i make it to work with Parallel desktop or VMware fusion software.

    I have Win 7 saved (installation file) in My MacBook Pro Licence version. How can i install it on MacBook Pro. After installation how can i make it to work with Parallel desktop or VMware fusion software. I can buy these softwares.

    http://www.simplehelp.net/2009/02/02/how-to-install-windows-7-in-os-x-using-para llels-desktop-a-complete-walkthrough/
    http://blogs.parallels.com/consumertech/2011/10/24/install-windows-right-from-wi thin-parallels-desktop-7-guest.html

  • How can i make any of the choices in a JRadioButtons not selectable?

    How can i make any of the choices in a JRadioButtons not selectable? The user cannot select any of them.. I have made logical relationship between JRadioButtons by the ButtonGroup..
    thanks..

    setEnabled( false );

  • I do not have master card,visa card to make my apple ID,tell me how can I make my apple ID with out master card and visa card

    I do not have master card,visa card to make my apple ID,tell me how can I make my apple ID with out master card and visa card

    It will if you follow, exactly, the instructions on the page that lllaass included in the post above yours : Create an iTunes Store, App Store, or iBooks Store account without a credit card or other payment method

  • How can I make my computer restart with all the same windows that were open when a shut it down?

    How can I make my computer restart with all the same windows that were open when a shut it down?

    That is the way Mac OS X 10.8 (aka Mountain Lion) works by default. Are you actually running that system? (See About This Mac in the Apple menu.) If so, make sure the check box in the shut down alert is checked:

  • How can I make my app available with out logging in

    Hi guys,
    How can I make my application available with out logging in. In other word, it should work as a normal website no user name or pass word is required ?
    Best Regards,
    Fateh

    Hi Fateh,
    Edit your page, and under the security of your page change the authentication from page requires authentication to page is public
    Authentication: page is PublicSo, that your page wont ask for a login.
    Brgds,
    Mini
    Mark Answers Promptly

  • How Can I Make a Membership Website With Adobe Muse? Like Youtube, Facebook, Twitter.

    How Can I Make a Membership Website With Adobe Muse? Like Youtube, Facebook, Twitter. I need help!

    Yeah me too

  • Help - I have an apple id account, where is my iPod and iPad registered, but also the iPod of my daughter. How can I make an account for my daughter and keep all the apps she has on her iPod?

    Help - I have an apple id account, where is my iPod and iPad registered, but also the iPod of my daughter. How can I make an account for my daughter and keep all the apps she has on her iPod and in her own iTunes?

    Sorry, content bought with one Apple ID cannot be merged or transferred to another Apple ID.

  • How can I make the playback buttons of YouTube and other plug-ins bigger since they are so tiny?

    How can I make the playback buttons of YouTube and other plug-ins bigger since they are so tiny in Firefox? I tried some suggestions that dealt with entering "about:config" in a fresh browser, but to no avail. I also downloaded an add-on called "Theme Font & Size Changer", but that didn't work either. So, I am reaching out here as that was a suggestion that another user here offered.

    Ah, yes- that is an ultra high DPI (dots per inch) display. This is a known issue in Flash Player, which Adobe is working on fixing.
    In the mean time, you can get some videos to have normal-sized controls by switching Youtube to the HTML5 video player:
    In Firefox, go to https://www.youtube.com/html5 and click the "Request the HTML5 player" button.

Maybe you are looking for

  • Multiple Forests SSO with BO Edge 3.1

    I have to setup and configure SSO on a 3.1 Edge with multiple forests. The setup looks like this right now. BO Servers (call it BOXIServer) are in one forest (call it BODomain.top.local) AD users and groups on another forest (call it UsersDomain.bott

  • HT1766 White Screen, NOTHING works! PLEASE HELP!!!

    Okay, so I was on the Facebook app on my iPod Touch... Then the screen froze, shortly after that my screen turned white. The two button thing isn't working and i don't know what to do, i don't live near an Apple Store, and i can't go there. so someon

  • Screen black but backlight on slightly

    So, my Iphone screen is pretty cracked and lived a nice long time before the screen went out. I used to be able to fix using the recovery mode (holding on/off and home) however now that no longer works. when the phone is plugged in Itunes recongnizes

  • HT3777 where can i download BootCamp for windows 7?

    Where can i download BootCamp in order to install windows 7 on my MacBook PRO? thx

  • How to transfer photos

    How do I transfer photos to a digital photo frame from iphoto on my mac computer?