From: Joshua O'M. <jos...@gm...> - 2007-08-29 21:49:08
|
Barak: Try doing a search for 'headless' in the JUNG web forum archives. Also, please send all responses to the jung-support list. I'm not the only person answering questions, and in this case I'm far from the most informed. :) Joshua On 8/29/07, Barak Ori <bar...@tr...> wrote: > Joshua, > > Thanks for the info, but rendered where to? I would like to generate graphs > in a headless environment. I was hoping the paint would render to my > BufferedImage. Whatever's happening before the rendering, is there a way to > manually make it happen? > > Thanks. > > > Joshua O'Madadhain wrote: > Barak: If I recall correctly, the graph has to be rendered before you can > use this method to store an image. Joshua On 8/29/07, Barak Ori > <bar...@tr...> wrote: > I took one of the samples available with JUNG, and I'm trying to store the > result graph in an image file (e.g. JPEG). I followed the 2nd > sample presented in the FAQ > (http://jung.sourceforge.net/developer_faq.txt) under the > CAPTURING GRAPHS section. It starts like this: public void > writeJPEGImage(VisualizationViewer vv, String filename) { > int width = vv.getLayout().getCurrentSize().width; int height = > vv.getLayout().getCurrentSize().height; The problem is that when I > actually call the vv.getLayout().getCurrentSize().width, it doesn't compile > - there's no getCurrentSize on the layout. I tried using getWidth() and > getHeight() on the vv variable directly, but both of these functions return > 0. I tried fixing the width & height to the values I know (I created > the VisualizationViewer a few lines above so I know the size), but the > image came out empty (all background). It seems that > vv.paintComponents(graphics) should do the job, but nothing happens. Am I > doing the paint too early? Do I need to wait for some initializations or > perform them myself before the paint can > work? Thanks. ------------------------------------------------------------------------- This > SF.net email is sponsored by: Splunk Inc. Still grepping through log files > to find problems? Stop. Now Search log events and configuration files using > AJAX and a browser. Download your FREE copy of Splunk now >> > http://get.splunk.com/ _______________________________________________ Jung-support > mailing > list Jun...@li... https://lists.sourceforge.net/lists/listinfo/jung-support > > > -- jos...@gm......................www.ics.uci.edu/~jmadden Joshua O'Madadhain: Information Scientist, Musician, Philosopher-At-Tall It's that moment of dawning comprehension that I live for. -- Bill Watterson My opinions are too rational and insightful to be those of any organization. |